Spiking Neuron Network Simulator  1.0
Simulation and training of spiking neuron networks, primarily theta neurons
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Pages
ErrorDerivativeParametersBatch.cs
Go to the documentation of this file.
1 namespace SpikingNeuronNetwork.Lib.Training
2 {
3  using Interfaces;
4  using System;
5  using System.Collections.Generic;
6  using System.Linq;
7 
12  {
16  public Dictionary<Synapse, Tuple<double, int>> ErrorDerivativeTotal { get; set; }
17 
23  {
24  ErrorDerivativeTotal = new Dictionary<Synapse, Tuple<double, int>>();
25  foreach (var synapse in errorDerivativeParameters.GetSynapses())
26  {
27  ErrorDerivativeTotal.Add(synapse, new Tuple<double, int>(errorDerivativeParameters.GetErrorDerivative(synapse), 1));
28  }
29  }
30 
36  public void AddErrorDerivative(Synapse synapse, double errorDerivativeValue)
37  {
38  if (ErrorDerivativeTotal.ContainsKey(synapse))
39  {
40  ErrorDerivativeTotal[synapse] = new Tuple<double, int>(
41  ErrorDerivativeTotal[synapse].Item1 + errorDerivativeValue,
42  ErrorDerivativeTotal[synapse].Item2 + 1);
43  }
44  else
45  {
46  ErrorDerivativeTotal.Add(synapse, new Tuple<double, int>(errorDerivativeValue, 1));
47  }
48  }
49 
54  public List<Synapse> GetSynapses()
55  {
56  return ErrorDerivativeTotal.Keys.ToList();
57  }
58 
64  public double GetErrorDerivative(Synapse synapse)
65  {
66  return ErrorDerivativeTotal[synapse].Item1 / ErrorDerivativeTotal[synapse].Item2;
67  }
68  }
69 }
ErrorDerivativeParametersBatch(ErrorDerivativeParameters errorDerivativeParameters)
Creates a new instance of ErrorDerivativeParametersBatch from an ErrorDerivateParameters object ...
double GetErrorDerivative(Synapse synapse)
Get the derivate of the error relative change in weight for a certain synapse
List< Synapse > GetSynapses()
Gets a list of the synapses for which there are error derivative parameters
Error Derivative Parameters Batch Class For Tracking Running Totals in Error Derivatives ...
void AddErrorDerivative(Synapse synapse, double errorDerivativeValue)
Adds errorDerivativeValue to the ErrorDerivativeTotal dictionary at synapse