public void AddInputPerceptron(string id, out Perceptron perceptron) { if (InputPerceptrons == null) { InputPerceptrons = new List <Perceptron>(); } perceptron = InputPerceptrons.SingleOrDefault(p => p.Id == id); if (perceptron == null) { Perceptron inputPerceptron = perceptron = new Perceptron() { Id = id }; InputPerceptrons.Add(inputPerceptron); OutputPerceptrons?.ForEach(p => p.Synaptics.Add(new Synaptic(inputPerceptron))); } }
public void AddOutputPerceptron(string id, out Perceptron perceptron) { if (OutputPerceptrons == null) { OutputPerceptrons = new List <Perceptron>(); } perceptron = OutputPerceptrons.SingleOrDefault(p => p.Id == id); if (perceptron == null) { Perceptron outputPerceptron = perceptron = new Perceptron() { Id = id, Synaptics = new List <Synaptic>() }; OutputPerceptrons.Add(outputPerceptron); InputPerceptrons?.ForEach(p => outputPerceptron.Synaptics.Add(new Synaptic(p))); } }
internal Synaptic(Perceptron perceptron) { Perceptron = perceptron; PerceptronId = perceptron.Id; Weight = (float)rnd.NextDouble(); }