Loading training data

For this example, we are simply making up our test and training data on-the-fly. The LoadTrainingData() function does just that:

private void LoadTrainingData(float[][] X, float[][] Y)
{
//clear the list first
listView1.Clear();
listView1.GridLines = true;
listView1.HideSelection = false;
if (X == null || Y == null )
return;

//add features
listView1.Columns.Add(new ColumnHeader() {Width=20});
for (int i=0; i < inDim ;i++)
{
var col1 = new ColumnHeader
{
Text = $"x{i + 1}",
Width = 70
};
listView1.Columns.Add(col1);
}

//Add label
var col = new ColumnHeader
{
Text = $"y",
Width = 70
};
listView1.Columns.Add(col);
for (int i = 0; i < 100; i++)
{
var itm = listView1.Items.Add($"{(i+1).ToString()}");
for (int j = 0; j < X[i].Length; j++)
itm.SubItems.Add(X[i][j].ToString(CultureInfo.InvariantCulture));
itm.SubItems.Add(Y[i][0].ToString(CultureInfo.InvariantCulture));
}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset