public void TestCostFunctionAccumulation() { NNetwork network = NNetwork.SigmoidNetwork(new int[] { 2, 4, 3 }); NetworkTrainer trainer = new NetworkTrainer(network); double[] train_set = new[] { 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1 }; Assert.Throws(typeof(NoErrorInfoYetException), () => trainer.GetError()); double error; trainer.TrainPrediction(train_set); error = trainer.GetError(); Assert.AreNotEqual(error, 0); trainer.TrainPrediction(train_set); Assert.AreNotEqual(error, trainer.GetError()); }
public void TrainPrediction() { NNetwork network = NNetwork.SigmoidNetwork(new int[] { 5, 2, 2 }); NetworkTrainer trainer = new NetworkTrainer(network); double[] train_set = new double[] { 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1 }; trainer.TrainPrediction(train_set); //todo }