O'Reilly logo

Hands-On Machine Learning with C# by Matt R. Cole

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tests

Tests are actual execution events, small programs if you will. Because of the usage of OpenCL, these programs are compiled at runtime. To create a test, you only need to provide a single static Run function that encapsulates your code. Kelp.Net comes with a preconfigured tester, which makes it very simple to add your own tests. We will explore this in detail in our section on writing tests, for now, here is an example of a simple XOR test program:

public static void Run()         {             const int learningCount = 10000;              Real[][] trainData =             {                 new Real[] { 0, 0 },                 new Real[] { 1, 0 },                 new Real[] { 0, 1 },                 new Real[] { 1, 1 }             };              Real[][] trainLabel =             {                 new Real[] { 0 },                 new Real[] { 1 },                 new Real[] { 1 },                 new Real[] { 0 }             };  FunctionStack nn = new ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required