Commit dd3b939e authored by Martin Beseda's avatar Martin Beseda

ENH: Added test of generating of isotropic dataset

parent 09db7b58
......@@ -10,6 +10,7 @@
#include <fstream>
#include <vector>
#include <utility>
#include <algorithm>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include "Network/NeuralNetwork.h"
......@@ -70,7 +71,20 @@ void test1( ){
/**
* Test of DataSet serialization
*/
std::vector<double> out_f(std::vector<double> v) {
double sum = 0;
for(auto& e : v) {
sum += e;
}
std::vector<double> out{sum*2, sum*3, sum*4};
return out;
}
void test3() {
/* Manually created data set */
std::cout << "Manually created data set" << std::endl;
std::vector<std::pair<std::vector<double>, std::vector<double>>> data_vec;
std::vector<double> inp, out;
......@@ -90,6 +104,19 @@ void test3() {
DataSet ds2("stored_data.4ds");
ds2.print_data();
/* Isotropic data set */
std::cout << "Isotropic data set:" << std::endl;
std::vector<double> bounds{0,3,0,2};
std::cout << "original one:" << std::endl;
DataSet ds3(bounds, 5, out_f, 3);
ds3.print_data();
ds3.store_text("stored_data2.4ds");
std::cout << "loaded one:" << std::endl;
DataSet ds4("stored_data2.4ds");
ds4.print_data();
}
double particle_swarm_test_function(double *x){
......@@ -226,17 +253,20 @@ void test_particle_swarm_neural_net(){
// swarm_01.optimize(0.5, accuracy);
//}
int main(int argc, char** argv){
// test1();
// test_particle_swarm();
test_particle_swarm_neural_net();
// test_particle_swarm_neural_net();
// test2();
// test3();
test3();
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment