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

FIX + ENH: Fixed network dimensions according to the new data. Now handling...

FIX + ENH: Fixed network dimensions according to the new data. Now handling even 'bad argument' exceptions.
parent 334b8b7f
No related branches found
No related tags found
No related merge requests found
...@@ -39,12 +39,13 @@ int main(int argc, char** argv){ ...@@ -39,12 +39,13 @@ int main(int argc, char** argv){
try { try {
/* Read data from the file */ /* Read data from the file */
l4n::CSVReader reader("/home/martin/Desktop/ANN_DATA_1_SET.txt", "\t", true); // l4n::CSVReader reader("/home/martin/Desktop/ANN_DATA_1_SET.txt", "\t", true);
l4n::CSVReader reader("/tmp/data_Heaviside.txt", "\t", false);
reader.read(); reader.read();
/* Create data set for both the training and testing of the neural network */ /* 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, 27, 28, 29 }; std::vector<unsigned int> inputs = { 0 };
std::vector<unsigned int> outputs = {18, 19, 20, 21, 22, 23, 24, 25, 26}; std::vector<unsigned int> outputs = { 1 };
l4n::DataSet ds = reader.get_data_set(&inputs, &outputs); l4n::DataSet ds = reader.get_data_set(&inputs, &outputs);
ds.normalize(); ds.normalize();
...@@ -52,7 +53,7 @@ int main(int argc, char** argv){ ...@@ -52,7 +53,7 @@ int main(int argc, char** argv){
// ds.print_data(); // ds.print_data();
/* Neural network construction */ /* Neural network construction */
std::vector<unsigned int> neuron_numbers_in_layers = {1, 10, 10, 9}; std::vector<unsigned int> neuron_numbers_in_layers = {1, 10, 10, 1};
l4n::FullyConnectedFFN nn(&neuron_numbers_in_layers, l4n::NEURON_TYPE::LOGISTIC); l4n::FullyConnectedFFN nn(&neuron_numbers_in_layers, l4n::NEURON_TYPE::LOGISTIC);
/* Error function */ /* Error function */
...@@ -124,10 +125,13 @@ int main(int argc, char** argv){ ...@@ -124,10 +125,13 @@ int main(int argc, char** argv){
return 0; return 0;
} catch(const std::runtime_error& e) { } catch(const std::runtime_error& e) {
std::cerr << e.what(); std::cerr << e.what() << std::endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} catch(const std::out_of_range& e) { } catch(const std::out_of_range& e) {
std::cerr << e.what(); std::cerr << e.what() << std::endl;
exit(EXIT_FAILURE);
} catch(const std::invalid_argument& e) {
std::cerr << e.what() << std::endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
......
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