Created
October 14, 2018 17:34
-
-
Save NMZivkovic/054887fe8867175c04303c786042bcb7 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 class VisibleLayer : Layer | |
{ | |
public VisibleLayer(int numberOfNeurons) : base(numberOfNeurons) | |
{ | |
} | |
public override void CalculateCDState() | |
{ | |
foreach (var neuron in Neurons) | |
{ | |
var probability = _sigmoid.CalculateOutput(neuron.Outputs.Where(x => x.InputNeruon.CDState).Sum(y => y.Weight)); | |
neuron.CDState = probability < _random.NextDouble(); | |
} | |
} | |
public void PushValuesToInput(bool[] input) | |
{ | |
if (input.Length != Neurons.Count) | |
{ | |
throw new ArgumentException("Input has invalid size"); | |
} | |
for (int i = 0; i < input.Length; i++) | |
{ | |
Neurons[i].State = input[i]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment