1 namespace SpikingNeuronNetwork.Test
4 using Microsoft.VisualStudio.TestTools.UnitTesting;
6 using System.Collections.Generic;
21 var desiredSpikeTimes =
new List<Spike>
23 new Spike {NeuronIndex = 0, Time = 1}
25 var actualSpikeTimes =
new List<Spike>
27 new Spike {NeuronIndex = 0, Time = 1.1}
30 SumOfSquareSpikingErrorTestHelper(desiredSpikeTimes, actualSpikeTimes, 0.005);
40 var desiredSpikeTimes =
new List<Spike>
42 new Spike {NeuronIndex = 0, Time = 1},
43 new Spike {NeuronIndex = 1, Time = 3}
45 var actualSpikeTimes =
new List<Spike>
47 new Spike {NeuronIndex = 0, Time = 1.1},
48 new Spike {NeuronIndex = 1, Time = 2.8}
51 SumOfSquareSpikingErrorTestHelper(desiredSpikeTimes, actualSpikeTimes, 0.025);
54 #region Helper Methods
62 private static void SumOfSquareSpikingErrorTestHelper(List<Spike> desiredSpikeTimes, List<Spike> actualSpikeTimes,
double expectedError)
65 var error = errorCalculator.GetError(desiredSpikeTimes, actualSpikeTimes);
67 errorCalculator.SimulationMethod = SimulationMethod.EventDriven;
68 var errorDerivativesEventDriven = errorCalculator.GetErrorToOutputSpikeTimeDerivative(desiredSpikeTimes, actualSpikeTimes);
69 errorCalculator.SimulationMethod = SimulationMethod.Numerical;
70 var errorDerivativesNumerical = errorCalculator.GetErrorToOutputSpikeTimeDerivative(desiredSpikeTimes, actualSpikeTimes);
71 Assert.AreEqual(errorDerivativesEventDriven.Count, errorDerivativesNumerical.Count);
72 for (var j = 0; j < errorDerivativesEventDriven.Count; j++)
74 Assert.IsTrue(Math.Abs(errorDerivativesEventDriven[j] - errorDerivativesNumerical[j]) <
TestHelper.
Epsilon);
Tests the sum of squared error calculation between spike trains
void SumOfSquaredSpikingErrorOneOutputNeuronTest()
Tests the sum of squared error calculation between spike trains containing one spike ...
static double Epsilon
Small value is used when comparing floats in various tests
Set of helper methods for various spiking neuron network tests
Sum of Squared Spiking Error Class
void SumOfSquaredSpikingErrorTwoOutputNeuronsTest()
Tests the sum of squared error calculation between spike trains containing two spikes ...