Programa para el testeo de las funciones.Para compilar o código example_logisticregression_meansquare_hard.cpp:
g++ -static -o example_logisticregression_meansquare_hard example_logisticregression_meansquare_hard.cpp -lpdsmlmm -lpdsramm -lpdsspmm
Para executar o programa:
./example_logisticregression_meansquare_hard
Retornando por consola:
W_ms_conf:
0.54735453715447 4.5966020377534 -13.467304051768
W_ms:
0.54735453715474 4.5966020377536 -13.467304051769
W_ms_conf:
12.840026069741 9.1677022674658 -27.478493922404
W_ms_w:
12.840026069741 9.1677022674659 -27.478493922405
Classification - Mean square conf
Classification - Mean square
Classification - W mean square conf
Classification - W mean square
Código example_logisticregression_meansquare_hard.cpp:
#include <iostream>
#include <Pds/Ra>
#include <Pds/Ml>
int main(void)
{
Pds::Matrix X(Pds::Ra::TextFormat,"../test/hard2-data-x.txt");
Pds::Vector Y(Pds::Ra::TextFormat,"../test/hard2-data-y.txt");
Pds::Vector W;
Pds::Vector d=Y.BalancedBinaryWeight(0.5);
W.T().Print("W_ms_conf:\n");
Pds::Octave::XLabel="x_1";
Pds::Octave::YLabel="x_2";
Pds::Octave::Plot::PointsX2DYW(X,Y,W,"testando.m","example_logisticregression_meansquare_hard_ms-conf.png");
W.T().Print("W_ms:\n");
Pds::Octave::Plot::PointsX2DYW(X,Y,W,"testando.m","example_logisticregression_meansquare_hard_ms.png");
W.T().Print("W_ms_conf:\n");
Pds::Octave::Plot::PointsX2DYW(X,Y,W,"testando.m","example_logisticregression_meansquare_hard_wms-conf.png");
W.T().Print("W_ms_w:\n");
Pds::Octave::Plot::PointsX2DYW(X,Y,W,"testando.m","example_logisticregression_meansquare_hard_wms.png");
return 0;
}
La clase tipo Pds::IterationConf . Esta clase genera una matriz de Nlin lineas y 1 columna....
bool SetAlpha(double Alpha)
Coloca el valor alpha.
bool SetMinError(double MinError)
Coloca el valor MinError.
Pds::Vector FittingLogitMeanSquare(Pds::IterationConf &Conf, const Pds::Matrix &X, const Pds::Vector &Y, double Delta=0.0001)
Calculo de pesos.
Pds::Vector FittingLogitWeightedMeanSquare(Pds::IterationConf &Conf, const Pds::Matrix &X, const Pds::Vector &Y, const Pds::Vector &D, double Delta=0.0001)
Calculo de pesos.