Home | Develop | Download | Contact
example_logisticregression_w0.cpp

Programa para el testeo de las funciones.Para compilar o código example_logisticregression_w0.cpp:

g++ -static -o example_logisticregression_w0 example_logisticregression_w0.cpp -lpdsmlmm -lpdsramm -lpdsspmm

Para executar o programa:

./example_logisticregression_w0

Retornando por consola:

W0:
-0.19761437373493       0.69316252037071        0.69316252037071
W0:
1.3531290967742 1       1
W0:
-0.42161372586748       -1      0.63252353657496
Classification - data


Classification - Pds::LogisticModel::GetW0MeanMethod(X)


Classification - Pds::LogisticModel::GetW0CornerMeanMethod(X)


Classification - Pds::LogisticModel::GetW0MeanSquareMethod(X)

Código example_logisticregression_w0.cpp:

#include <iostream>
#include <Pds/Ra>
#include <Pds/Ml>
int main(void)
{
Pds::Ra::Randomize();
Pds::Vector Yp;
// Generating data
Pds::Matrix X(Pds::Ra::TextFormat,"../test/hard-data-x.txt");
Pds::Vector Y(Pds::Ra::TextFormat,"../test/hard-data-y.txt");
Pds::Vector W0;
Pds::Octave::DAspect=true;
Pds::Octave::XLabel="x_1";
Pds::Octave::YLabel="x_2";
Pds::Octave::Plot::PointsX2DY(X,Y,"testando.m","example_logisticregression_w0_data.png");
// Create W0 using training data
W0.T().Print("W0=Pds::LogisticModel::GetW0MeanMethod(X);\n");
Pds::Octave::Plot::PointsX2DYW(X,Yp,W0,"testando.m","example_logisticregression_w0_mean.png");
// Create W0 using training data
W0.T().Print("W0=Pds::LogisticModel::GetW0CornerMeanMethod(X);\n");
Pds::Octave::Plot::PointsX2DYW(X,Yp,W0,"testando_corner.m","example_logisticregression_w0_meancorner.png");
// Create W0 using training data
W0.T().Print("W0=Pds::LogisticModel::GetW0MeanSquareMethod(X);\n");
Pds::Octave::Plot::PointsX2DYW(X,Yp,W0,"testando.m","example_logisticregression_w0_meansquare.png");
return 0;
}
Pds::Vector GetW0CornerMeanMethod(const Pds::Matrix &X, double Delta=0.001)
Obtiene de forma rapida un vector inicial para usar en regresion logistica.
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.
Pds::Vector GetW0MeanSquareMethod(const Pds::Matrix &X)
Obtiene de forma rapida un vector inicial para usar en regresion logistica.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed