SuperNN  1.0.0
neuron.cpp
1 /*
2  This file is part of SuperNN.
3 
4  SuperNN is free software: you can redistribute it and/or modify
5  it under the terms of the GNU Lesser General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  SuperNN is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public License
15  along with SuperNN. If not, see <http://www.gnu.org/licenses/>.
16 
17  Copyright (C) 2010 - 2015 Lucas Hermann Negri
18 */
19 
20 #include "neuron.hpp"
21 
22 namespace SuperNN
23 {
25 {
26 }
27 
29 {
30 }
31 
32 Connection::Connection(unsigned _l, unsigned _n, double _w)
33  : weight(_w), to_layer(_l), to_neuron(_n)
34 {
35 }
36 
38 {
39 }
40 
41 Neuron::Neuron(bool _b) : net(0.0), out(0.0), err(0.0), delta(0.0), act_func(ACT_SIGMOID_SYMMETRIC),
42  steep(1.0), delta_ok(false), bias(_b)
43 {
44 }
45 
46 void Neuron::connect(unsigned to_layer, unsigned to_neuron)
47 {
48  conns.push_back(Connection(to_layer, to_neuron));
49 }
50 
51 void Neuron::set_activation(ActFuncType type, double s)
52 {
53  act_func = type;
54  steep = s;
55 }
56 
57 }
std::vector< Connection > conns
Synaptic connections.
Definition: neuron.hpp:133
Synaptic connection between two neurons.
Definition: neuron.hpp:32
Sigmoid symmetric activation function.
void set_activation(ActFuncType type, double s=1)
Sets the neuron activation function.
Definition: neuron.cpp:51
Neuron(bool _b=false)
Constructor.
Definition: neuron.cpp:41
double steep
Activation function steepness.
Definition: neuron.hpp:151
void connect(unsigned to_layer, unsigned to_neuron)
Adds a connection to a neuron.
Definition: neuron.cpp:46
virtual ~Neuron()
Definition: neuron.cpp:37
virtual ~Connection()
Definition: neuron.cpp:28
ActFuncType act_func
Used activation function.
Definition: neuron.hpp:148
ActFuncType
Activation functions built-in in the library.