Home | Develop | Download | Contact
example_ensembleperceptron_export.cpp

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

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

Para executar o programa:

./example_ensembleperceptron_export

Retornando por consola:

EP0:
Perceptron[0]:
1    -1.1 2.1  
Perceptron[1]:
2    -1.2 2.2  
Perceptron[2]:
1    -1.1 2.1  
Perceptron[3]:
1  -1 2  
Saving file: ensemble1.txt
Saving file: ensemble2.txt
Saving file: ensemble3.txt
Saving file: ensemble4.txt
+++ All data saved.

Loading file: ensemble1.txt
Loading file: ensemble2.txt
Loading file: ensemble3.txt
Loading file: ensemble4.txt

EP1:
Perceptron[0]:
1    -1.1 2.1  
Perceptron[1]:
2    -1.2 2.2  
Perceptron[2]:
1    -1.1 2.1  
Perceptron[3]:
1  -1 2  

Código example_ensembleperceptron_export.cpp:

#include <iostream>
#include <Pds/Ra>
#include <Pds/Ml>
int main(void)
{
Pds::Matrix ColsW="1.0 2.0 1.0 1.0\n-1.1 -1.2 -1.1 -1.0\n2.1 2.2 2.1 2.0";
// Create Perceptron
EP0.Print("\nEP0:\n");
std::string filename="ensemble1.txt";
EP0.ExportFile(filename);
std::cout<<"+++ All data saved.\n";
// Test export import
Pds::EnsemblePerceptron EP1(filename);
EP1.Print("\nEP1:\n");
return 0;
}
La clase tipo Pds::EnsemblePerceptron . Esta clase genera una matriz de Nlin lineas y 1 columna....
bool ExportFile(const std::string &filename) const
Salva en formato texto el objeto de tipo Pds::EnsemblePerceptron.
void Print(std::string str="") const
Imprime en pantalla el contenido del vector de pesos después del texto indicado en str.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed