Skip to content
Snippets Groups Projects
Commit 40a9f26d authored by Martin Beseda's avatar Martin Beseda
Browse files

ENH: Modified output from MSE evaluation functions

parent 2b08861a
Branches
Tags
No related merge requests found
...@@ -105,7 +105,7 @@ namespace lib4neuro { ...@@ -105,7 +105,7 @@ namespace lib4neuro {
size_t dim_in = data_set->get_input_dim(); size_t dim_in = data_set->get_input_dim();
size_t dim_out = data_set->get_output_dim(); size_t dim_out = data_set->get_output_dim();
double error = 0.0, val, output_norm; double error = 0.0, val, output_norm = 0;
std::vector<std::pair<std::vector<double>, std::vector<double>>>* data = data_set->get_data(); std::vector<std::pair<std::vector<double>, std::vector<double>>>* data = data_set->get_data();
size_t n_elements = data->size(); size_t n_elements = data->size();
...@@ -168,20 +168,22 @@ namespace lib4neuro { ...@@ -168,20 +168,22 @@ namespace lib4neuro {
output_norm += denormalized_output * denormalized_output; output_norm += denormalized_output * denormalized_output;
} }
#ifdef L4N_DEBUG #ifdef L4N_DEBUG
COUT_DEBUG(i << ": " COUT_DEBUG("[" << i << "] "
<< ss_input.str() << " ; " << ss_input.str() << " "
<< ss_real_output.str() << " ; " << ss_real_output.str() << " "
<< ss_predicted_output.str() << "; " << ss_predicted_output.str() << " "
<< std::sqrt(error) << "; " << std::sqrt(error) << " "
<< 2 * std::sqrt(error) / (std::sqrt(error) + std::sqrt(output_norm)) << << 2 * std::sqrt(error) / (std::sqrt(error) + std::sqrt(output_norm))
std::endl); << std::endl);
*results_file_path << i << ": " *results_file_path << "["
<< ss_input.str() << " ; " << i << "] "
<< ss_real_output.str() << " ; " << ss_input.str() << " "
<< ss_predicted_output.str() << "; " << ss_real_output.str() << " "
<< std::sqrt(error) << "; " << ss_predicted_output.str() << " "
<< std::sqrt(error) << " "
<< 2 * std::sqrt(error) / (std::sqrt(error) + std::sqrt(output_norm)) << << 2 * std::sqrt(error) / (std::sqrt(error) + std::sqrt(output_norm)) <<
std::endl; std::endl;
#endif #endif
...@@ -214,7 +216,7 @@ namespace lib4neuro { ...@@ -214,7 +216,7 @@ namespace lib4neuro {
THROW_RUNTIME_ERROR("File path: " + results_file_path + " was not successfully opened!"); THROW_RUNTIME_ERROR("File path: " + results_file_path + " was not successfully opened!");
} }
ofs << "[Input] [Real output] [Predicted output]" << std::endl; ofs << "[Index ][Input] [Real output] [Predicted output]" << std::endl;
for (auto i = 0; i < data->size(); i++) { // Iterate through every element in the test set for (auto i = 0; i < data->size(); i++) { // Iterate through every element in the test set
...@@ -241,10 +243,10 @@ namespace lib4neuro { ...@@ -241,10 +243,10 @@ namespace lib4neuro {
} else { } else {
denormalized_output = outputs.at(i).at(j); denormalized_output = outputs.at(i).at(j);
} }
COUT_DEBUG("Element " << i << ": " COUT_DEBUG("[" << i << "] "
<< data->at(i).first.at(j) << " " << data->at(i).first.at(j) << " "
<< data->at(i).second.at(j) << " " << data->at(i).second.at(j) << " "
<< denormalized_output << std::endl); << denormalized_output << std::endl);
ofs << data->at(i).first.at(j) << " " ofs << data->at(i).first.at(j) << " "
<< data->at(i).second.at(j) << " " << data->at(i).second.at(j) << " "
...@@ -306,10 +308,10 @@ namespace lib4neuro { ...@@ -306,10 +308,10 @@ namespace lib4neuro {
} else { } else {
denormalized_output = outputs.at(i).at(j); denormalized_output = outputs.at(i).at(j);
} }
COUT_DEBUG("Element " << i << ": " COUT_DEBUG("[" << i << "] "
<< data->at(i).first.at(j) << " " << data->at(i).first.at(j) << " "
<< data->at(i).second.at(j) << " " << data->at(i).second.at(j) << " "
<< denormalized_output << std::endl); << denormalized_output << std::endl);
val = denormalized_output - data->at(i).second.at(j); val = denormalized_output - data->at(i).second.at(j);
error += val * val; error += val * val;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment