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

ENH: Added exception catching to the Simulator example.

parent b53e443e
No related branches found
No related tags found
No related merge requests found
......@@ -39,17 +39,20 @@ int main(int argc, char** argv){
try {
/* Read data from the file */
l4n::CSVReader reader("/home/martin/5Desktop/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 = {10, 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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment