44 Pds::Matrix X(Pds::Ra::TextFormat,
"../test/data_x_yinyang.txt");
45 Pds::Matrix Y(Pds::Ra::TextFormat,
"../test/data_y_yinyang.txt");
46 Pds::Matrix Ys(Y.Size());
48 std::vector<unsigned int> N={2,5,11,23,11,5,1};
61 for(
unsigned int k=0;k<M;k++)
68 Acc0.Set(k,100.0*Pds::Accuracy(Ys.Geq(0.5),Y));
71 Acc1.Set(k,100.0*Pds::Accuracy(Ys.Geq(0.5),Y));
74 Acc2.Set(k,100.0*Pds::Accuracy(Ys.Geq(0.5),Y));
77 str=
"acc0: "+std::to_string(Acc0.At(k));
78 str=str+
"\tacc1: "+std::to_string(Acc1.At(k));
79 str=str+
"\tacc2: "+std::to_string(Acc2.At(k));
80 Pds::Ra::ProgressBarWithTime(32,k,M,
false,str);
85 Pds::Octave::XLabel=
"Iter";
86 Pds::Octave::YLabel=
"Accuracy";
87 Pds::Octave::Legend={
"Pds::Sigmoid",
"Compound"};
88 Pds::Octave::Plot::CurveXYXY( Pds::LinSpace(0,M-1,M),Acc0,
89 Pds::LinSpace(0,M-1,M),Acc1,
91 "example_fcnn_training_actfunc_Acc01.png");
92 Pds::Octave::Legend={
"Pds::Sigmoid",
"Pds::Tanh"};
93 Pds::Octave::Plot::CurveXYXY( Pds::LinSpace(0,M-1,M),Acc0,
94 Pds::LinSpace(0,M-1,M),Acc2,
96 "example_fcnn_training_actfunc_Acc02.png");
98 Pds::Octave::XLabel=
"x_1";
99 Pds::Octave::YLabel=
"x_2";
100 Pds::Octave::Plot::PointsX2DY(X,Y ,
"testando.m",
"example_fcnn_training_actfunc_Y.png");
103 Pds::Octave::Plot::PointsX2DY(X,Ys,
"testando.m",
"example_fcnn_training_actfunc_Ys0.png");
106 Pds::Octave::Plot::PointsX2DY(X,Ys,
"testando.m",
"example_fcnn_training_actfunc_Ys1.png");
109 Pds::Octave::Plot::PointsX2DY(X,Ys,
"testando.m",
"example_fcnn_training_actfunc_Ys2.png");
La clase tipo Pds::FCNn . Esta clase genera un objeto con dos parametros Nlin y Ncol....
const std::string FCNn
Tag de un objeto de tipo Pds::FCNn.
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::SampleBlock Predict(const Pds::SampleBlock &In) const
Evalua la capa de la CNN.
bool SetActFunc(unsigned int k, double(*func)(double), double(*dfunc)(double))
Retorna true si la funcion de activacion fue modificada o false si no.