public void FeedForwardNeuralNetwork_ThreeLayerTrainTest() { var target = new FeedForwardNeuralNetwork <double>( new[] { 2L, 2L, 1L }); var pattern = new NeuralNetworkTrainingPattern <double, ArrayMathVector <double>, ArrayMathVector <double> >[] { new NeuralNetworkTrainingPattern <double, ArrayMathVector <double>, ArrayMathVector <double> >( new ArrayMathVector <double>(new[] { 0.0, 0.0 }), new ArrayMathVector <double>(new[] { 0.0 })), new NeuralNetworkTrainingPattern <double, ArrayMathVector <double>, ArrayMathVector <double> >( new ArrayMathVector <double>(new[] { 0.1, 0.0 }), new ArrayMathVector <double>(new[] { 1.0 })), new NeuralNetworkTrainingPattern <double, ArrayMathVector <double>, ArrayMathVector <double> >( new ArrayMathVector <double>(new[] { 0.0, 1.0 }), new ArrayMathVector <double>(new[] { 1.0 })), new NeuralNetworkTrainingPattern <double, ArrayMathVector <double>, ArrayMathVector <double> >( new ArrayMathVector <double>(new[] { 1.0, 1.0 }), new ArrayMathVector <double>(new[] { 0.0 })) }; var rand = new Random(); var field = new DoubleField(); target.Train( pattern, 100, field, (d1, d2) => { return(1.0 / (1.0 + Math.Exp(-d2 + d1))); }, (u, v, l) => { var result = 0.0; for (var i = 0L; i < l; ++i) { result += u[i] * v[i]; } return(result); }, (y) => y * (1 - y), (w, y, i) => w[i], (c, w) => { //var len = c.LongLength; //for(var i = 0L;i< len; ++i) //{ // c[i] = rand.NextDouble(); //} //len = w.LongLength; //for(var i = 0L; i < len; ++i) //{ // var curr = w[i]; // var innerLen = curr.LongLength; // for (var j = 0L; j < innerLen; ++j) // { // w[i][j] = rand.NextDouble(); // } //} c[0] = 0.6; c[1] = 0.6; c[2] = 0.6; w[0][0] = 1.0; w[0][1] = -1.0; w[1][0] = -1.0; w[1][1] = 1.0; w[2][0] = 1.0; w[2][1] = 1.0; }); var outputMatrix = target.InternalReserveOutput(); Func <double, double, double> activationFunction = (d1, d2) => { if (d2 > d1) { return(1.0); } else { return(0.0); } }; Func <double[], double[], long, double> propFunc = (u, v, l) => { var result = 0.0; for (var i = 0L; i < l; ++i) { result += u[i] * v[i]; } return(result); }; target.InternalComputeLayerOutputs( new ArrayMathVector <double>(new[] { 0.0, 1.0 }), outputMatrix, activationFunction, propFunc); Assert.Inconclusive("Test not yet completed."); }