Hands-On Neural Network Programming with C#
上QQ阅读APP看书,第一时间看更新

Testing the data

This section details the Test function, which will show us how to test the data we have trained. We get the network prediction and track the accuracy for each label that we have with the following command:

private void Test(Volume x, int[] labels, CircularBuffer<double> accuracy, bool forward = true)
{
if (forward)
{

Forward momentum can be found with the following code:

this._net.Forward(x);
}
var prediction = this._net.GetPrediction();
for (var i = 0; i < labels.Length; i++)
{

To track the accuracy, input the following code:

accuracy.Add(labels[i] == prediction[i] ? 1.0 : 0.0);
}
}