Newer
Older
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
124
125
#ifndef NEURON_H_
#define NEURON_H_
/**
* Module containing classes representing neurons
* in neural networks.
*
* @author Martin Beseda
* @author Martin Mrovec
* @author Michal Kravčenko
* @date 2017 - 2018
*/
/**
* Abstract class representing a general neuron
*/
class Neuron{
private:
/**
* Inner potential of the neuron (input of the activation function)
*/
double potential = 0.0;
/**
* State of the neuron (output of the activation function)
*/
double state = 0.0;
/**
* array of the activation function parameters
*/
double *activation_function_parameters = nullptr;
/**
* Number of parameters of the activation function
*/
int n_activation_function_parameters = 0;
public:
/**
* Destructor of the Neuron object
* this level deallocates the array 'activation_function_parameters'
*/
virtual ~Neuron();
/**
* Performs the activation function and stores the result into the 'state' property
*/
virtual void activate() = 0;
/**
* Adds the input signal value to the current potential
* @param[in] input_signal Input value
*/
virtual void adjust_potential(double input_signal);
/**
* Getter to the 'potential' property
* @return Value of the neuron's potential (real number)
*/
virtual double get_potential();
/**
* Setter to the 'potential' property
* @param value Value of the neuron's potential (real number)
*/
virtual void set_potential(double value);
/**
* Getter to the 'state' property
* @return Value of the current neuron's state
*/
virtual double get_state();
/**
* Setter to the 'state' component
* @param value Value of the current neuron's state
*/
virtual void set_state(double value);
/**
* Returns the number of parameters the activation function relies on
* @return Number of the parameters
*/
virtual int activation_function_get_n_parameters();
/**
* Calculates the partial derivative of the activation function
* with respect to the parameter and the current potential
* @param param_idx Index of the parameter to calculate derivative of
* @return Partial derivative of the activation function according to the
* 'param_idx'-th parameter
*/
virtual double activation_function_get_partial_derivative(int param_idx) = 0;
/**
* Adjusts the parameter with index 'param_idx' of the activation function
* by the value prescribed by 'value'
* @param param_idx Index of the parameter to be adjusted
* @param value Value of the adjustment
*/
virtual void activation_function_adjust_parameter(int param_idx, double value);
/**
* Sets the parameter with index 'param_idx' of the activation function
* to the value prescribed by 'value'
* @param param_idx
* @param value
*/
virtual void activation_function_set_parameter(int param_idx, double value);
/**
* Gets the parameter with index 'param_idx' of the activation function
* @param param_idx
*/
virtual double activation_function_get_parameter(int param_idx);
}; /* end of Neuron class */
#endif /* NEURON_H_ */