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
949a9a11
Commit
949a9a11
authored
6 years ago
by
Michal Kravcenko
Browse files
Options
Downloads
Patches
Plain Diff
ADD: adjusted and added new learning methods
parent
1f7bcf7c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/examples/simulator.cpp
+12
-9
12 additions, 9 deletions
src/examples/simulator.cpp
with
12 additions
and
9 deletions
src/examples/simulator.cpp
+
12
−
9
View file @
949a9a11
...
...
@@ -12,21 +12,22 @@
#include
<assert.h>
#include
"4neuro.h"
#include
"../LearningMethods/KallmanFilter.h"
#include
"../LearningMethods/KalmanFilter.h"
#include
"../LearningMethods/RandomSolution.h"
int
main
(
int
argc
,
char
**
argv
)
{
bool
normalize_data
=
true
;
double
prec
=
1e-9
;
double
prec_lm
=
1e-
15
;
double
prec_lm
=
1e-
9
;
int
restart_interval
=
500
;
int
max_n_iters_gradient
=
10000
;
int
max_n_iters_gradient_lm
=
10000
;
int
max_n_iters_swarm
=
20
;
int
n_particles_swarm
=
200
;
int
batch_size
=
0
;
int
max_number_of_cycles
=
5
;
unsigned
long
batch_size
=
0
;
int
max_number_of_cycles
=
1
;
try
{
/* PHASE 1 - TRAINING DATA LOADING, NETWORK ASSEMBLY AND PARTICLE SWARM OPTIMIZATION */
l4n
::
CSVReader
reader1
(
"/home/fluffymoo/Dropbox/data_BACK_RH_1.csv"
,
";"
,
true
);
// File, separator, skip 1st line
...
...
@@ -43,7 +44,7 @@ int main(int argc, char** argv) {
}
/* Numbers of neurons in layers (including input and output layers) */
std
::
vector
<
unsigned
int
>
neuron_numbers_in_layers
=
{
1
,
6
,
6
,
1
};
std
::
vector
<
unsigned
int
>
neuron_numbers_in_layers
=
{
1
,
2
,
2
,
1
};
/* Fully connected feed-forward network with linear activation functions for input and output */
/* layers and the specified activation fns for the hidden ones (each entry = layer)*/
...
...
@@ -84,17 +85,19 @@ int main(int argc, char** argv) {
// 1) Threshold for the successful ending of the optimization - deviation from minima
// 2) Number of iterations to reset step size to tolerance/10.0
// 3) Maximal number of iterations - optimization will stop after that, even if not converged
l4n
::
RandomSolution
rnd
;
l4n
::
GradientDescent
gs_
(
prec
,
restart_interval
,
max_n_iters_gradient
,
batch_size
);
l4n
::
GradientDescentBB
gs
(
prec
,
restart_interval
,
max_n_iters_gradient
,
batch_size
);
l4n
::
GradientDescentSingleItem
gs_si
(
prec
,
0
,
5000
);
//TODO needs improvement
l4n
::
LevenbergMarquardt
leven
(
max_n_iters_gradient_lm
,
prec_lm
);
l4n
::
LevenbergMarquardt
leven
(
max_n_iters_gradient_lm
,
batch_size
,
prec_lm
);
l4n
::
KalmanFilter
kalman
(
prec
,
max_n_iters_gradient_lm
,
batch_size
);
l4n
::
LearningSequence
learning_sequence
(
1e-6
,
max_number_of_cycles
);
l4n
::
KallmanFilter
kallman
(
prec
,
max_n_iters_gradient_lm
);
learning_sequence
.
add_learning_method
(
&
rnd
);
// learning_sequence.add_learning_method( &ps );
// learning_sequence.add_learning_method( &gs );
//
learning_sequence.add_learning_method( &leven );
learning_sequence
.
add_learning_method
(
&
kal
l
man
);
learning_sequence
.
add_learning_method
(
&
leven
);
//
learning_sequence.add_learning_method( &kalman );
// learning_sequence.add_learning_method( &gs_ );
// learning_sequence.add_learning_method( &gs_si );
// learning_sequence.add_learning_method( &gs );
...
...
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