Last active
October 14, 2018 17:25
-
-
Save NMZivkovic/15712b9e785b377b632e2cbc2a59128d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class Layer | |
{ | |
public List<INeuron> Neurons { get; } | |
protected Sigmoid _sigmoid; | |
protected Random _random; | |
public Layer(int numberOfNeurons) | |
{ | |
Neurons = new List<INeuron>(); | |
_random = new Random(); | |
for (int i = 0; i < numberOfNeurons; i++) | |
{ | |
Neurons.Add(new Neuron(GenerateRandomBool(), _random.NextDouble())); | |
} | |
} | |
public void ConnectLayers(Layer layer) | |
{ | |
foreach(var thisNeuron in this.Neurons) | |
{ | |
foreach(var layerNeruon in layer.Neurons) | |
{ | |
layerNeruon.AddInputNeuron(thisNeuron, _random.NextDouble()); | |
} | |
} | |
} | |
private bool GenerateRandomBool() | |
{ | |
return _random.NextDouble() > 0.5; | |
} | |
public abstract void CalculateCDState(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment