Home | Develop | Download | Contact
test_fcnn_training.cpp
1 #include <Pds/Ra>
2 #include <Pds/Nn>
3 #include "extras.h"
4 
5 int main(void)
6 {
7  unsigned int M=2000;
8  Pds::Vector Acc(M);
9 
10  Pds::Matrix X(Pds::Ra::TextFormat,"../test/data_x_yinyang.txt");
11  Pds::Matrix Y(Pds::Ra::TextFormat,"../test/data_y_yinyang.txt");
12  Pds::Matrix Ys(Y.Size());
13 
14  std::vector<unsigned int> N={2,512,64,8,1};
15  Pds::FCNn NN0=Pds::FCNn(N,Pds::Sigmoid,Pds::DSigmoid);
16 
17  Pds::Ra::Tic();
18  for(unsigned int k=0;k<M;k++)
19  {
20  NN0.Training(X,Y,0.1,0.01);
21 
22  NN0.Evaluate(X,Ys);
23 
24  Acc.Set(k,100.0*Pds::Accuracy(Ys.Geq(0.5),Y));
25  std::cout<<"Test["<<k<<"]\t";
26  std::cout<<"Accuracy %: "<<Acc.At(k)<<std::endl;
27  }
28  Pds::Ra::Toc();
29 
30  pds_octave_plot_points(Pds::LinSpace(0,M-1,M),Acc,"Iter","Accuracy","testando.m","test_fcnn_training_Acc.png");
31  pds_octave_plot_vector(X,Y ,"x_1","x_2","testando.m","test_fcnn_training_Y.png");
32  pds_octave_plot_vector(X,Ys,"x_1","x_2","testando.m","test_fcnn_training_Ys.png");
33 
34  NN0.Save("../test/NeuralNettwork1.txt");
35  return 0;
36 }
La clase tipo Pds::FCNn . Esta clase genera un objeto con dos parametros Nlin y Ncol....
Definition: FCNn.hpp:61
bool Training(const Pds::Matrix &X, const Pds::Matrix &Y, double alpha, double lambda)
Treina la NN como um bloque de datos entero X para encontrar una variacion de pesos.
Pds::Vector Evaluate(const Pds::Vector &In)
Evalua la capa de la CNN.
bool Save(std::string filename)
Salva los datos en un archivo binario.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed