This is C# wrapper that allows you to leverage MATLAB's Neural Network Toolbox, creating, configuring, training and simulating two-layer neural networks. Requires MATLAB.
//Initializes the wrapper starting a MATLAB session
Wrapper wrapper = new Wrapper();
//This is our training set of 3 examples
double[,] input = new double[3, 2] { { 0.1, 0.2 }, { 0.3, 0.4 }, { 0.5, 0.6 } };
double[,] output = new double[3, 1] { { 0 }, { 0.8 }, { 1 } };
//Creates a network with 2 input units and 5 hidden units
Net net = new Net(wrapper, 2, 5);
//Trains using MATLAB
net.Train(input, output);
//After training, tests the network on a new input
Console.WriteLine(net.Execute(new double[] { 0.1, 0.2 }));
- Add a reference in your project to MATLAB Application Type Library in COM Tab in Visual Studio.
- Add the MLNetWrapper.cs file to your project and build.
- Different training functions
- Pre/post-processing function: mapminmax and removeconstantrows
- Different transfer functions: tansig and purelin
- Change training, validation and test samples ratio
- Hide MATLAB's training window
- Set maximum number of epochs
- Parallel training