public static void Gate(Neuron from, Neuron to, Neuron gate, double weight) { var l = new NeuronLink { From = from, To = to, Weight = weight, Gate = gate }; from.OutProject.Add(l); to.InProject.Add(l); if (gate != Neuron.NoGate) { gate.OutGate.Add(l); } }
public Neuron(string name, bool autoBias = true) { Name = name; SelfLink.From = this; SelfLink.To = this; SelfLink.Gate = NoGate ?? this; if (autoBias) { var l = new NeuronLink { From = BiasNeuron, To = this, Weight = 0, Gate = NoGate }; this.InProject.Add(l); BiasNeuron.OutProject.Add(l); } }
public static void Connect(Neuron from, Neuron to) { var l = new NeuronLink() { From = from, To = to, Weights = new double[from.Size, to.Size] }; from.OutLinks = from.OutLinks.Union(new[] { l }).ToArray(); to.InLinks = to.InLinks.Union(new[] { l }).ToArray(); }
public void RemoveLink(NeuronLink l) { Console.WriteLine(" ### Removed link (" + l.From.Name + ")->(" + l.To.Name + ") - Usefulness: " + l.Usefulness() + " ###"); if (l.From == l.To) { l.Gate.OutRemember.Remove(l); l.Gate = Neuron.NoGate; } else { l.From.OutProject.Remove(l); l.To.InProject.Remove(l); l.Gate.OutGate.Remove(l); } }