private static void Test(NeuralNetwork nn, int tests = -1) { tests = tests == -1 ? testing.Count : tests; tests = Math.Min(testing.Count, tests); int score = 0; for (int i = 0; i < tests; i++) { Console.WriteLine($"Starting Test {i}/{tests}"); MnistEntry entry = testing[i]; NNFeedData inputData = new NNFeedData(3, 5, ConvertArray(entry.Image)); NNFeedData outputData = nn.FeedForward(inputData); (int label, float value)guess = ArrayToLabel(outputData.CopyData()); if (guess.label == entry.Label) { score++; } Console.WriteLine($"{entry.Label} | {guess.label} ({guess.value:F2})"); } Console.WriteLine($"{score}/{tests}"); }
internal override NNDetailedFeedData FeedForward(NNFeedData input) { if (input.Width != Width || input.Height != Height || input.Depth != Depth) { throw new ArgumentOutOfRangeException(nameof(input)); } float[] output = input.CopyData(); return(new NNDetailedFeedData(this, output, output)); }