Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
lib4neuro
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MolDyn
lib4neuro
Commits
55416ed8
Commit
55416ed8
authored
6 years ago
by
Michal Kravcenko
Browse files
Options
Downloads
Patches
Plain Diff
ADD: added a new neuron to represent a never-changing shift of the input values
parent
66e62e12
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Neuron/NeuronBiased.cpp
+34
-0
34 additions, 0 deletions
src/Neuron/NeuronBiased.cpp
src/Neuron/NeuronBiased.h
+63
-0
63 additions, 0 deletions
src/Neuron/NeuronBiased.h
with
97 additions
and
0 deletions
src/Neuron/NeuronBiased.cpp
0 → 100644
+
34
−
0
View file @
55416ed8
/**
* DESCRIPTION OF THE FILE
*
* @author Michal Kravčenko
* @date 15.3.19 -
*/
#include
"NeuronBiased.h"
#include
"NeuronConstant.h"
namespace
lib4neuro
{
NeuronBiased
::
NeuronBiased
(
double
b
)
{
this
->
bias
=
b
;
}
double
NeuronBiased
::
activate
(
double
x
,
double
b
)
{
return
x
+
this
->
bias
;
}
double
NeuronBiased
::
activation_function_eval_derivative
(
double
x
,
double
b
)
{
return
1.0
;
}
double
NeuronBiased
::
activation_function_eval_derivative_bias
(
double
x
,
double
b
)
{
return
0.0
;
}
Neuron
*
NeuronBiased
::
get_derivative
()
{
NeuronConstant
*
output
=
new
NeuronConstant
(
1.0
);
return
output
;
}
}
//end of namespace lib4neuro
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/Neuron/NeuronBiased.h
0 → 100644
+
63
−
0
View file @
55416ed8
/**
* DESCRIPTION OF THE FILE
*
* @author Michal Kravčenko
* @date 15.3.19 -
*/
#ifndef LIB4NEURO_NEURONBIASED_H
#define LIB4NEURO_NEURONBIASED_H
#include
"Neuron.h"
namespace
lib4neuro
{
class
NeuronBiased
:
public
NeuronDifferentiable
{
private:
double
bias
;
public:
/**
* Struct used to access private properties from
* the serialization function
*/
struct
access
;
/**
* Constructs the object of the Linear neuron with activation function
* f(x) = x + b
* @param[in] b Bias
*/
LIB4NEURO_API
explicit
NeuronBiased
(
double
b
);
/**
* Evaluates 'x + this->bias' and stores the result into the 'state' property
*/
LIB4NEURO_API
double
activate
(
double
x
,
double
b
)
override
;
/**
* Calculates the partial derivative of the activation function
* f(x) = x + this->bias at point x
* @return Partial derivative of the activation function according to the
* 'bias' parameter. Returns 0.0
*/
LIB4NEURO_API
double
activation_function_eval_derivative_bias
(
double
x
,
double
b
)
override
;
/**
* Calculates d/dx of (x + this->bias) at point x
* @return 1.0
*/
LIB4NEURO_API
double
activation_function_eval_derivative
(
double
x
,
double
b
)
override
;
/**
* Returns a pointer to a Neuron with derivative as its activation function
* @return
*/
LIB4NEURO_API
Neuron
*
get_derivative
(
)
override
;
};
}
//end of namespace lib4neuro
#endif //LIB4NEURO_NEURONBIASED_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment