26 Pds::Vector GradientCostNewMS(Pds::Vector W,Pds::Matrix X,Pds::Vector Y,
double K=10.0)
28 unsigned int L=X.Nlin();
29 unsigned int N=X.Ncol()+1;
32 double S=2.0*K/(L*Norm);
33 Pds::Vector Wn=W/Norm;
35 Pds::Matrix R=Pds::RegressorMatrix(X);
36 Pds::Vector F=Pds::Sigmoid(K*R*Wn);
37 Pds::Vector b=S*(F-Y).Product(F.Product(1.0-F));
38 Pds::Matrix I=Pds::Eye(N);
40 Pds::Vector DW=(b.T())*R*(I-Wn.MMt());
52 Pds::Octave::DAspect=
true;
53 Pds::Octave::YLimits=
true;
57 Pds::Matrix X(Pds::Ra::TextFormat,
"../test/hard-data-x.txt");
58 Pds::Vector Y(Pds::Ra::TextFormat,
"../test/hard-data-y.txt");
75 Pds::Octave::Plot::PointsX2DYW(X,Y,W,
"testando_w.m",
"test_working_steps_0.png");
82 for(
unsigned int n=1;n<=60;n++)
84 std::cout<<
"\n n: "<<n<<
"\n";
87 if(Pds::Hb(Yo.Mean())<=0.0)
93 DW=GradientCostNewMS(W,X,Y,K);
104 Pds::Octave::Title=
"NMS:"+std::to_string(E1);
105 Pds::Octave::Plot::PointsX2DYW(X,Y,W,
"testando_w.m",
"test_working_steps_"+std::to_string(n)+
".png");
La clase tipo Pds::IterationConf . Esta clase genera una matriz de Nlin lineas y 1 columna....
Pds::Vector FittingLogitMeanSquare(Pds::IterationConf &Conf, const Pds::Matrix &X, const Pds::Vector &Y, double Delta=0.0001)
Calculo de pesos.
double CostMeanSquare(const Pds::Vector &W, const Pds::Matrix &X, const Pds::Vector &Y)
Calculo de pesos.
Pds::Vector FittingGradientCrossEntropy(Pds::IterationConf &Conf, const Pds::Matrix &X, const Pds::Vector &Y, const Pds::Vector &W0)
Gradiente descendente para sigmoide.
Pds::Vector Classify(const Pds::Vector &W, const Pds::Matrix &X)
Calculo del resultado del clasificador.
Pds::Vector GetW0MeanMethod(const Pds::Matrix &X)
Obtiene de forma rapida un vector inicial para usar en regresion logistica.