#include <Pds/Ra>
#include <Pds/Nn>
int main(void)
{
unsigned int M=8000;
Pds::Vector Acc0(M);
Pds::Vector Acc1(M);
Pds::Vector Acc2(M);
std::string str;
Pds::Matrix X(Pds::Ra::TextFormat,"../test/data_x_yinyang.txt");
Pds::Matrix Y(Pds::Ra::TextFormat,"../test/data_y_yinyang.txt");
Pds::Matrix Ys(Y.Size());
std::vector<unsigned int> N={2,5,11,23,11,5,1};
for(unsigned int k=0;k<M;k++)
{
Acc0.Set(k,100.0*Pds::Accuracy(Ys.Geq(0.5),Y));
Acc1.Set(k,100.0*Pds::Accuracy(Ys.Geq(0.5),Y));
Acc2.Set(k,100.0*Pds::Accuracy(Ys.Geq(0.5),Y));
str="acc0: "+std::to_string(Acc0.At(k));
str=str+"\tacc1: "+std::to_string(Acc1.At(k));
str=str+"\tacc2: "+std::to_string(Acc2.At(k));
Pds::Ra::ProgressBarWithTime(32,k,M,false,str);
}
std::cout<<std::endl;
Pds::Octave::XLabel="Iter";
Pds::Octave::YLabel="Accuracy";
Pds::Octave::Legend={"Pds::Sigmoid","Compound"};
Pds::Octave::Plot::CurveXYXY( Pds::LinSpace(0,M-1,M),Acc0,
Pds::LinSpace(0,M-1,M),Acc1,
"testandoAcc01.m",
"example_fcnn_training_actfunc_Acc01.png");
Pds::Octave::Legend={"Pds::Sigmoid","Pds::Tanh"};
Pds::Octave::Plot::CurveXYXY( Pds::LinSpace(0,M-1,M),Acc0,
Pds::LinSpace(0,M-1,M),Acc2,
"testandoAcc02.m",
"example_fcnn_training_actfunc_Acc02.png");
Pds::Octave::XLabel="x_1";
Pds::Octave::YLabel="x_2";
Pds::Octave::Plot::PointsX2DY(X,Y ,"testando.m","example_fcnn_training_actfunc_Y.png");
Pds::Octave::Plot::PointsX2DY(X,Ys,"testando.m","example_fcnn_training_actfunc_Ys0.png");
Pds::Octave::Plot::PointsX2DY(X,Ys,"testando.m","example_fcnn_training_actfunc_Ys1.png");
Pds::Octave::Plot::PointsX2DY(X,Ys,"testando.m","example_fcnn_training_actfunc_Ys2.png");
return 0;
}
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.