Last active
October 14, 2018 07:03
-
-
Save NMZivkovic/c7736bbbab64a5795e8c971807a71b20 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 interface INeuron | |
{ | |
bool State { get; set; } | |
bool CDState { get; set; } | |
double Bias { get; } | |
List<IConnection> Inputs { get; } | |
List<IConnection> Outputs { get; } | |
void AddInputNeuron(INeuron inputNeuron, double weight); | |
void AddOutputNeuron(INeuron outputNeuron, double weight); | |
} | |
public class Neuron : INeuron | |
{ | |
public bool State { get; set; } | |
public bool CDState { get; set; } | |
public double Bias { get; } | |
public List<IConnection> Inputs { get; } | |
public List<IConnection> Outputs { get; } | |
public Neuron(bool initialState, double bias) | |
{ | |
State = initialState; | |
Bias = bias; | |
Inputs = new List<IConnection>(); | |
Outputs = new List<IConnection>(); | |
} | |
public void AddInputNeuron(INeuron inputNeuron, double weight) | |
{ | |
var connection = new Connection(weight, inputNeuron, this); | |
Inputs.Add(connection); | |
inputNeuron.Outputs.Add(connection); | |
} | |
public void AddOutputNeuron(INeuron outputNeuron, double weight) | |
{ | |
var connection = new Connection(weight, this, outputNeuron); | |
Outputs.Add(connection); | |
outputNeuron.Inputs.Add(connection); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment