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
3befbc41
Commit
3befbc41
authored
6 years ago
by
Martin Beseda
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Added exception catching to the Simulator example.
parent
b53e443e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/examples/simulator.cpp
+11
-5
11 additions, 5 deletions
src/examples/simulator.cpp
with
11 additions
and
5 deletions
src/examples/simulator.cpp
+
11
−
5
View file @
3befbc41
...
...
@@ -39,17 +39,20 @@ int main(int argc, char** argv){
try
{
/* Read data from the file */
l4n
::
CSVReader
reader
(
"/home/martin/
5
Desktop/ANN_DATA_1_SET.txt"
,
"
\t
"
,
true
);
l4n
::
CSVReader
reader
(
"/home/martin/Desktop/ANN_DATA_1_SET.txt"
,
"
\t
"
,
true
);
reader
.
read
();
/* Create data set for both the training and testing of the neural network */
std
::
vector
<
unsigned
int
>
inputs
=
{
2
,
3
,
4
,
5
,
6
,
7
,
8
,
26
,
27
,
28
};
std
::
vector
<
unsigned
int
>
inputs
=
{
1
};
std
::
vector
<
unsigned
int
>
outputs
=
{
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
,
25
};
l4n
::
DataSet
ds
=
reader
.
get_data_set
(
&
inputs
,
&
outputs
);
ds
.
normalize
();
// ds.print_data();
/* Neural network construction */
std
::
vector
<
unsigned
int
>
neuron_numbers_in_layers
=
{
1
0
,
10
,
10
,
9
};
std
::
vector
<
unsigned
int
>
neuron_numbers_in_layers
=
{
1
,
10
,
10
,
9
};
l4n
::
FullyConnectedFFN
nn
(
&
neuron_numbers_in_layers
,
l4n
::
NEURON_TYPE
::
LOGISTIC
);
/* Error function */
...
...
@@ -118,9 +121,12 @@ int main(int argc, char** argv){
std
::
cout
<<
"error of the "
<<
data_idx
<<
"-th element: "
<<
get_rel_error
(
output_norm
,
expected_output_norm
)
<<
std
::
endl
;
}
catch
(
const
lib4neuro
::
FileNotFoundException
&
e
)
{
return
0
;
}
catch
(
const
std
::
runtime_error
&
e
)
{
std
::
cout
<<
e
.
what
();
return
-
1
;
}
return
0
;
}
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