diff --git a/src/main.cpp b/src/main.cpp index f975268b26864a7381a85017b5b51d16a6768d5f..e72bf404f89d05f1cc394043572ded7d5dfea389 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,6 +8,8 @@ #include <iostream> #include <cstdio> #include <fstream> +#include <vector> +#include <utility> #include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> #include "Network/NeuralNetwork.h" @@ -19,6 +21,7 @@ #include "LearningMethods/ParticleSwarm.h" #include "Neuron/NeuronBinary.h" #include "Neuron/NeuronTanh.h" +#include "DataSet/DataSet.h" //TODO prepsat tak, aby neuronova sit managovala destruktory vsech potrebnych objektu (kvuli serializaci) /** @@ -171,6 +174,31 @@ void test2() { << n8.activation_function_get_parameter(0) << std::endl; } +/** + * Test of DataSet serialization + */ +void test3() { + std::vector<std::pair<std::vector<double>, std::vector<double>>> data_vec; + std::vector<double> inp, out; + + for(int i = 0; i < 3; i++) { + inp.push_back(i); + out.push_back(i+4); + } + + data_vec.emplace_back(std::make_pair(inp, out)); + + DataSet ds(&data_vec); + + ds.print_data(); + + ds.store_text("stored_data.4ds"); + + DataSet ds2("stored_data.4ds"); + + ds2.print_data(); +} + double particle_swarm_test_function(double *x){ // return x[0] * x[1] - x[0] * x[0] + x[1] * x[2]; return x[0] * x[0]; @@ -311,9 +339,11 @@ int main(int argc, char** argv){ // test_particle_swarm(); - test_particle_swarm_neural_net(); +// test_particle_swarm_neural_net(); + +// test2(); - test2(); + test3(); return 0; }