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
ccea58ad
Commit
ccea58ad
authored
5 years ago
by
Martin Beseda
Browse files
Options
Downloads
Patches
Plain Diff
[CODE] removed unnecessary comments in simulator_1_2.cpp
parent
40b93c16
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_1_2.cpp
+49
-49
49 additions, 49 deletions
src/examples/simulator_1_2.cpp
with
49 additions
and
49 deletions
src/examples/simulator_1_2.cpp
+
49
−
49
View file @
ccea58ad
...
...
@@ -106,55 +106,55 @@ int main(int argc, char** argv) {
/* Complex Optimization */
learning_sequence
.
optimize
(
mse1
);
// Network training
//
//
puts("*********************** 6");
//
//
/* Save Neural network parameters to file */
//
sim.save_text("test_net_Gradient_Descent.4n");
//
//
/* PHASE 4 - TESTING DATA */
//
//
/* Output file specification */
//
std::string filename = "simulator_output.txt";
//
std::ofstream output_file(filename);
//
if (!output_file.is_open()) {
//
throw std::runtime_error("File '" + filename + "' can't be opened!");
//
}
//
//
/* Neural network loading */
//
l4n::NeuralNetwork nn3("test_net_Gradient_Descent.4n");
//
//
/* Check of the saved network - write to the file */
//
output_file << std::endl << "The loaded network info:" << std::endl;
//
nn3.write_stats(&output_file);
//
nn3.write_weights(&output_file);
//
nn3.write_biases(&output_file);
////
////
/* Evaluate network on an arbitrary data-set and save results into the file */
//
l4n::CSVReader reader3("../../../data_files/data_BACK_RH_1.csv", ";", true); // File, separator, skip 1st line
//
reader3.read(); // Read from the file
////
////
/* Create data set for both the testing of the neural network */
////
/* Specify which columns are inputs or outputs */
////
//
std::shared_ptr<l4n::DataSet> ds3 = reader3.get_data_set(&inputs, &outputs); // Creation of data-set for NN
//
ds3.operator->()->set_normalization_strategy( new DoubleUnitStrategy());
//
if(normalize_data){
//
ds3.get()->normalize(); // Normalization of data to prevent numerical problems
//
}
////
////
output_file << std::endl << "Evaluating network on the dataset: " << std::endl;
////
ds3
.
store_data_text(&output_file);
////
//
output_file << "Output and the error:" << std::endl;
////
////
/* Error function */
//
l4n::MSE mse3(&nn3, ds3.get()); // First parameter - neural network, second parameter - data-set
//
//
mse3.eval_on_data_set(ds3.get(), &output_file, nullptr, normalize_data, true);
//
//
/* Close the output file for writing */
//
output_file.close();
puts
(
"*********************** 6"
);
/* Save Neural network parameters to file */
sim
.
save_text
(
"test_net_Gradient_Descent.4n"
);
/* PHASE 4 - TESTING DATA */
/* Output file specification */
std
::
string
filename
=
"simulator_output.txt"
;
std
::
ofstream
output_file
(
filename
);
if
(
!
output_file
.
is_open
())
{
throw
std
::
runtime_error
(
"File '"
+
filename
+
"' can't be opened!"
);
}
/* Neural network loading */
l4n
::
NeuralNetwork
nn3
(
"test_net_Gradient_Descent.4n"
);
/* Check of the saved network - write to the file */
output_file
<<
std
::
endl
<<
"The loaded network info:"
<<
std
::
endl
;
nn3
.
write_stats
(
&
output_file
);
nn3
.
write_weights
(
&
output_file
);
nn3
.
write_biases
(
&
output_file
);
/* Evaluate network on an arbitrary data-set and save results into the file */
l4n
::
CSVReader
reader3
(
"../../../data_files/data_BACK_RH_1.csv"
,
";"
,
true
);
// File, separator, skip 1st line
reader3
.
read
();
// Read from the file
/* Create data set for both the testing of the neural network */
/* Specify which columns are inputs or outputs */
std
::
shared_ptr
<
l4n
::
DataSet
>
ds3
=
reader3
.
get_data_set
(
&
inputs
,
&
outputs
);
// Creation of data-set for NN
ds3
.
operator
->
()
->
set_normalization_strategy
(
new
DoubleUnitStrategy
());
if
(
normalize_data
){
ds3
.
get
()
->
normalize
();
// Normalization of data to prevent numerical problems
}
output_file
<<
std
::
endl
<<
"Evaluating network on the dataset: "
<<
std
::
endl
;
ds3
->
store_data_text
(
&
output_file
);
output_file
<<
"Output and the error:"
<<
std
::
endl
;
/* Error function */
l4n
::
MSE
mse3
(
&
nn3
,
ds3
.
get
());
// First parameter - neural network, second parameter - data-set
mse3
.
eval_on_data_set
(
ds3
.
get
(),
&
output_file
,
nullptr
,
normalize_data
,
true
);
/* Close the output file for writing */
output_file
.
close
();
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