public NeuralNetwork(NeuralNetworkSettings settings) { Guard.NotNull(settings, nameof(settings)); this.settings = settings; layerInputs = NeuralNetworkArrayFactory.CreateLayers(Layers); layerOutputs = NeuralNetworkArrayFactory.CreateLayers(Layers); deltas = NeuralNetworkArrayFactory.CreateLayers(Layers); synapses = NeuralNetworkArrayFactory.CreateSynapses(Layers); }
public static void Main(string[] _) { var sigmoid = new SigmoidActivationFunction(); var settings = new NeuralNetworkSettings(0.1, new[] { new NeuralNetworkLayerSettings(2, new LinearActivationFunction()), new NeuralNetworkLayerSettings(5, sigmoid), new NeuralNetworkLayerSettings(1, sigmoid) }); var network = new NeuralNetwork(settings); for (var i = 0; i < 500000; ++i) { Train(network); } Test(network, true, false); Test(network, false, false); Test(network, true, true); Test(network, false, true); }