Jamie
Jamie

Reputation: 782

How Can I Pass a Time Series to NDtw Using VB.net

I would like to use the NDtw nuget package to compare two simple time series. The following code works in F# and is published at (https://www.codesuji.com/2016/12/13/F-and-Dynamic-Time-Warping/).

open NDtw

// Example comparison of 2 small datasets
let exampleDtw = new Dtw(
    [| 1.; 3.; 7.; 8.; 11.;  6.; 6.; |],
    [| 3.; 6.; 3.; 7.; 13.; 12.; 7.; |])


// Get the coordinate path used for the best match between the datasets
let output = exampleDtw.GetCost()

printf "%A" output

It works in F# but I want to be able to use the library in VB.net. The library also works in C# so it should also be able to be used in VB.net or any of the .net languages. The problem is that I cannot figure out what format the time series data should be in. The library contains a Class called SeriesVariable but I cannot figure out how that variable should be formatted. The format from the F# example does not work. Below is my code. I have tried square brackets, parentheses, adding commas, adding colon, etc.

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim dist As Int16

        Dim dtw As New Dtw([| 1.; 3.; 7.; 8.; 11.;  6.; 6.; |],[| 3.; 6.; 3.; 7.; 13.; 12.; 7.; |])

        dist = dtw.GetCost()

        TextBox3.Text = dist.ToString

    End Sub

How can I get this code to work?

Upvotes: 0

Views: 36

Answers (0)

Related Questions