Esempio n. 1
0
 public void PlugIn(List <Input> neurons)
 {
     foreach (var n in neurons)
     {
         var temp = n;
         foreach (var d in Dendrites.Where(d => d.Neuron.Name == temp.Name))
         {
             d.Neuron = n;
         }
     }
 }
Esempio n. 2
0
 public void ForceCreateDendrite(Neuron source, double strength)
 {
     if (DendriteStrength.ContainsKey(source))
     {
         DendriteStrength[source] = strength;
     }
     else
     {
         DendriteStrength.Add(source, strength);
         Dendrites.Add(source);
         source.Axons.Add(this);
     }
 }
        public override double GetOutput(NeuralPathway path = null)
        {
            if (path != null)
            {
                if (path.Path.Count(Equivelant) > 2)
                {
                    return(0);
                }
                path.Path.Add(this);
            }
            var sum = Dendrites.Aggregate <Dendrite, double>(0, (current, d) => current + (d.GetSignal(path)));

            return(Function(sum));
        }
Esempio n. 4
0
        public void CountError(Layer layer)
        {
            List <double> all_multiplications = new List <double>();

            foreach (var neuron in layer.Neurons)
            {
                if (neuron.Bias)
                {
                    continue;
                }
                double weight = Dendrites
                                .SingleOrDefault(x => x.TargetNeuron == neuron.ID)
                                .Weight;

                all_multiplications.Add(weight * neuron.ErrorSignal);
            }

            double result = Value * (1 - Value) * all_multiplications.Sum();

            ErrorSignal = result;
        }
Esempio n. 5
0
 public virtual void AddDendrites(List <Dendrite> dendrites)
 {
     Dendrites.AddRange(dendrites);
 }
Esempio n. 6
0
 public virtual void AddDendrite(Dendrite dendrite)
 {
     Dendrites.Add(dendrite);
 }
Esempio n. 7
0
        public virtual void Compute()
        {
            var sum = Dendrites.Sum(dendrite => dendrite.Value * dendrite.Weight);

            Axon.Value = Activation(sum);
        }
Esempio n. 8
0
 public int CountDendrites()
 {
     return(Dendrites.Count());
 }
Esempio n. 9
0
 public void UpdateWeights(double new_weights)
 {
     Dendrites.ToList().ForEach(x => x.SynapticWeight = new_weights);
 }
Esempio n. 10
0
 public void Calculate()
 {
     Value = Dendrites.Sum(x => x.Weight * x.Neuron.Value);
 }