-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLink.cpp
76 lines (62 loc) · 1.02 KB
/
Link.cpp
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
/*
* This class defines a link between two neurons, called predecessor and successor
*/
#include "Link.h"
#include "Neuron.h"
#include "ProblemInfo.h"
Link::Link(double weight, Neuron* prev, Neuron* succ)
: m_weight(weight)
, m_output(0.0)
, m_gradient(0.0)
, m_prevGradient(0.0)
, m_delta(INITIAL_STEP)
, m_next(succ)
, m_prev(prev)
{}
Link::~Link()
{}
double Link::weight() const
{
return m_weight;
}
double Link::output() const
{
return m_output;
}
double Link::gradient() const
{
return m_gradient;
}
double Link::previousGradient() const
{
return m_prevGradient;
}
double Link::delta() const
{
return m_delta;
}
Neuron* Link::predecessor() const
{
return m_prev;
}
Neuron* Link::successor() const
{
return m_next;
}
void Link::setWeight(double w)
{
m_weight = w;
}
void Link::setOutput(double o)
{
m_output = o;
}
void Link::setGradient(double g)
{
m_prevGradient = m_gradient;
m_gradient = g;
}
void Link::setDelta(double d)
{
m_delta = d;
}