-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSquareNeuron.cs
More file actions
123 lines (103 loc) · 2.82 KB
/
SquareNeuron.cs
File metadata and controls
123 lines (103 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
using System.IO;
using System;
using System.Collections;
using System.Collections.Generic;
namespace SLN
{
/// <summary>
/// An Izhikevich's neuron vith an "alternative" representation
/// </summary>
[Serializable]
internal class SquareNeuron : Neuron
{
/// <summary>
/// The decay parameter of th integration
/// </summary>
protected double decay;
/// <summary>
/// The decay parameter of th integration
/// </summary>
protected double gain;
internal SquareNeuron()
: base()
{
A = double.NaN;
B = double.NaN;
C = double.NaN;
D = double.NaN;
decay = 0.996;
gain = 0;
V = 0;
}
internal SquareNeuron(double d)
: base()
{
A = double.NaN;
B = double.NaN;
C = double.NaN;
D = double.NaN;
decay = d;
gain = 0;
V = 0;
}
internal SquareNeuron(double d, double g)
: base()
{
A = double.NaN;
B = double.NaN;
C = double.NaN;
D = double.NaN;
decay = d;
gain = g;
V = 0;
}
/// <summary>
/// Returns the membrane potential of the neuron
/// </summary>
/// <returns>The membrane potential of the neuron</returns>
internal double getV()
{
return V;
}
/// <summary>
/// Neset the neuron's state
/// </summary>
internal new void resetState()
{
resetI();
}
/// <summary>
/// Simulates the neuron behavior
/// </summary>
/// <param name="step">The current simulation step</param>
/// <returns><i>true</i> if the neuron fired a spike, <i>false</i> otherwise</returns>
internal new bool simulate(int step)
{
IPrev = I;
V = I;
resetI();
return false;
}
/// <summary>
/// Simulates the neuron behavior
/// </summary>
/// <param name="step">The current simulation step</param>
/// <returns><i>true</i> if the neuron fired a spike, <i>false</i> otherwise</returns>
internal bool simulateSameness(int step, bool integration)
{
IPrev = I;
if (integration)
{
V += I;
V += V * gain;
}
//if(step > Constants.SIMULATION_STEPS_FEEDFORWARD + Constants.SIMULATION_STEPS_LIQUID - 100)
if (0.001 * V > 0.01)
V = V - 0.01;
else
V = decay * V;
resetI();
return false;
}
}
}