Home | Develop | Download | Contact
example_logisticregression_kmeanstest.cpp

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

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

Para executar o programa:

./example_logisticregression_kmeanstest

Retornando por consola:

W:
0.045411802310072 0.090577312222274 0.090494055170035 
Accuracy: 0.7585
example_logisticregression_kmeanstest_y.png


example_logisticregression_kmeanstest_yp.png

Código example_logisticregression_kmeanstest.cpp:

#include <iostream>
#include <Pds/Ra>
#include <Pds/Ml>
int main(void)
{
Pds::Octave::XLabel="x_1";
Pds::Octave::YLabel="x_2";
Pds::Octave::XLimits=true;
Pds::Octave::YLimits=true;
// Generating data
Pds::Matrix X;
Pds::Vector Y;
unsigned int L=1000;
Pds::Octave::Plot::PointsX2DY(X,Y,"testando.m","example_logisticregression_kmeanstest_y.png");
Pds::Vector W;
Pds::Vector Yp;
// Create W using training data
W.T().Print("W:\n");
Pds::Octave::Plot::PointsX2DYW(X,Yp,W,"testando.m","example_logisticregression_kmeanstest_yp.png");
std::cout<<"Accuracy: "<<Pds::Accuracy(Y,Yp)<<"\n";
return 0;
}
La clase tipo Pds::IterationConf . Esta clase genera una matriz de Nlin lineas y 1 columna....
void LoadDataBand(unsigned int L, Pds::Matrix &X, Pds::Vector &Y)
Clasificacion de datos separados por mas de una curva.
Pds::Vector Classify(const Pds::Vector &W, const Pds::Matrix &X)
Calculo del resultado del clasificador.
Pds::Vector FittingKmeansLogitMeanSquare(Pds::IterationConf &Conf, const Pds::Matrix &X, const Pds::Vector &Y, double Delta)

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed