private void InitializeInputs(int numOfThisLayer) { if (numOfThisLayer == 0) { InitializeInputs_FirstLayerNeuron(); return; } Inputs = new NeuronInput[Layers[numOfThisLayer - 1].NeuronsList.Length]; }
private void AddLayerInput(int neurons) { var layer = new LayerInput { Neurons = new List <Neuron>(), }; for (var i = 1; i <= neurons; i++) { var neuron = new NeuronInput { Connections1 = new List <Connection>(), Connections2 = new List <Connection>(), }; neuron.Bias = Math2.Range(-1f, 1); layer.Neurons.Add(neuron); } this.Layers.Add(layer); }
public void TestSigmoidalFunction() { NeuronInput inputA = new NeuronInput(0.67, 1.5); NeuronInput inputB = new NeuronInput(0.5, 1.0); NeuronInput inputC = new NeuronInput(0.8, 0.8); NeuronInput[] inputs = new NeuronInput[3]; inputs[0] = inputA; inputs[1] = inputB; inputs[2] = inputC; SigmoidNeuron neuron = new SigmoidNeuron(inputs, 3.0); double output = neuron.SigmoidalFunction(); double expected = 0.99420529989699; double delta = expected - output; Assert.AreEqual(output, expected, delta); }
private void InitializeInputs_FirstLayerNeuron() { Inputs = new NeuronInput[InputValues.Length]; }