Home | Develop | Download | Contact
example_perceptron_kernel_gaussian_circle.cpp

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

g++ -static -o example_perceptron_kernel_gaussian_circle example_perceptron_kernel_gaussian_circle.cpp -lpdsnnmm

Para executar o programa:

./example_perceptron_kernel_gaussian_circle

Retornando por consola:

LogitMS:
Error: RMS(△ W)/Std(W)
-------------------------
   IterationConf data    
-------------------------
    Alpha: 0.001
   Lambda: 0.001
 MinError: 1e-05
  MaxIter: 10000
-------------------------
LastError: 0.00016096
 LastIter: 10000
-------------------------
GradientCE:
Error: RMS(△ W)/Std(W)
-------------------------
   IterationConf data    
-------------------------
    Alpha: 0.001
   Lambda: 0.001
 MinError: 1e-05
  MaxIter: 10000
-------------------------
LastError: 8.2538e-09
 LastIter: 1
-------------------------
    
Neurona:
-274.73740542618        -1058.9644345231        -609.4928262705 -1249.188716121 426.20587815109 867.59146784067 -86.066424718882        555.27694147859 1397.0692284244 67.236763345512 1174.4487097069 2052.6705171579 -632.33217311783        -1084.0460643945        -532.75940273494        1035.3022182324 1.2301886941223 177.20417589934 -21.006386207357        -179.66051647549        60.11636745275  2116.4791388567 228.04537860601 1453.9591792509 -732.47615776903        160.89381139549 -70.229300658266        -117.0352027381 1808.4536562427 640.40280066577 -256.8873931757 -702.43753585939        438.289529127   1470.5748629803 150.34100346808 -215.43205944079        169.10311190929 -555.16614263152        601.80233623681 1727.2508763681 17.188772035201 -1062.4306246147        -539.02611942869-646.05434920118        -421.3108135842 1406.3220581962 -168.85839835008        -541.55474750989        1939.4783828362 -547.4995419408 1123.9013259359 734.79527861469 -612.18827797355        -452.50505418664-1552.0493584   -526.27188132468        -554.09407347223        959.74305627139 230.51693275455 -524.7056345861 122.67302208365 -212.55371660696        -638.0474977656 590.417213283   1361.3611486206 752.5718354499  -485.16734132915        -760.18461894783        -1278.5225627216        2239.7435428372 -577.94966258351        -926.35191952952        1162.165120467  37.917264869676 350.63991156012 227.12987659519 969.35256015949 -1077.8809350745        366.913180417   -1128.8706908799        873.99703489622 -909.6574690921 701.72697407951 930.1332682759  1111.4563703646 1576.7457469978 -693.35960519307        1458.9305770664 -807.71463230844        850.60946504877 -878.16446252051        589.91045098206 213.48322986654 199.29511374379 764.35488937774 -566.56405207891        176.6150306917  -551.357506573  -418.49801208184        -291.46430405453        -526.39245645585        392.9826200346  474.1000311742  1014.8495418689 -391.90912453811        -79.453272020076        -886.39544483752        891.48944044059 -1067.9676270003        -63.926653605092        66.066464465977 722.19491537572 -57.955140588342        -162.66067666168        -189.29765092793        1293.0146626292 1056.0861442763 928.01887493395 181.30105427856 -214.40449320313        -34.555705583596        -432.03279318249        -539.6725205903 -1008.7687548236        61.262857472562 -835.24827509359        -744.56148220355-254.8186327551 540.81830991831 944.49306062921 326.40489423734 -387.66865844427        -1518.4694779951        -482.84654429202        377.56219044988 -282.81328739997        1220.41882084   613.42251241551 1504.6648837364 -47.906575667145        -571.34619064982        -249.85587054535        -550.27663114765        1002.939340555  1306.8361846841 -769.84788254608        1615.9912873835 -396.26550103507        901.25928820163 -219.89492298515        91.120346391368 36.840745562501 1068.4243662623 1464.7524984251 -47.117132470217        -98.442099439987        -206.06505812486        -407.96027113558487.58146557087 -943.4129890424 1569.7696704025 982.0388937836  115.39565893099 746.8599969407  324.68248141512 -200.04982048589        -336.03245249926        210.03921416826 842.3002058693  -157.93807148616        -222.12045383628        -452.73677949712        -1227.6708895391        640.43191904375 -949.83214867699        419.16664926576 435.22193647072 611.03761527793 359.8998984341  -616.70826983116597.32713310916 934.71135596014 -341.24634863112        639.47498619319 200.41529605269 -1240.7337211985        857.27145409163 997.33706617017 -1247.8373359686        -1283.0081641278        614.08171246859 -256.52447863113        1056.583515636  458.02218314818 715.90856942702 -48.230870160696        -277.64603121794        106.71640375135 -1091.7798944207        478.09259188986 2262.3670692221 988.36753217091 455.81601015394 -905.32571707818        1288.3072144907 -80.346127643858        110.0361041257  -712.83170426148        1236.1742705516 -50.054983235678        -501.38639932552        -351.185434267  -3028.3231613566        1481.7714814085 628.4028164554  -1374.8557056032        -432.23531044056        -70.095044411066        -1157.2662123572        -489.68171770293        66.772785916856 291.99568875263 -585.53827177111        910.14013003553 1043.5851538992 68.281037964561 756.85633884367 799.12091611653 663.00786862665 997.6631645962  89.862015776952 585.41964840837 146.45540008604 -1680.8900981636        -629.84037060397        554.93592824781 94.02009979943  -326.69155814055        443.31258843049 -1657.6025034509        -344.33447284188        -793.81184830651        -384.07271881842        -458.62461108156        -676.49852863439        -413.68121826074        810.07404950077 295.86003768807 -288.6923033006 -62.875927133916        -311.42495078025        -1104.8920248543-746.70276109273        326.53417655828 -31.239886181133        -20.286222896979        -596.7122593937 403.08541072784 -127.7380244618 -193.24751558902        150.07444816757 421.4563809164  -877.74732350637405.38567379584 480.3992429035  -128.17336375661        -546.09229533388        -79.223920684411        -717.71040320614        860.98031375761 -803.94800472949        1160.7452943044 -1028.5883958242-453.72308940691        432.140774033   -222.83080838331        -1014.7972178546        227.70002532268 -961.53654563045        -763.23036964041        -403.26202790923        -67.757883282125        -857.38926713943        714.23983750943 -281.67539267813        -196.92951506027        -158.50062038726        -470.62039205037        -546.93607577265        -78.556514729562        -631.10077898571        677.39213618756 -680.99162135259        -672.49949405421        531.4559697979  371.19942351254 -824.15882035104        416.81400601659 -647.23554262437        -810.66992408571        321.58048209129 -457.81586925069        971.11897416118 -544.36598061406        682.31903653627 -1222.5875435435        82.870847973824 -164.87591319714        -669.90180873446        13.806593345986 -505.41658874447        54.365246455934 103.83096524271 158.15099721268 -716.19876581853        175.63664926063 -208.26178769863        416.10325401731 799.17401852347 821.82306409587 665.80215167983 437.25811875493 -1129.5444116979-135.92014288902        855.6682977919  -1750.6911912039        1003.420465123  -747.4020197984 -263.09904129396        251.90238933084 518.22859386065 -466.77545141146        -380.17677724993        525.95115549727 -188.39744314654        -701.10062139719        -734.97626680691        610.56778020872 33.315377351658 282.26105060753 -287.85220541803        -556.56671865907        -566.1564785748 34.519275781683 440.93579173027 346.96256025753 1044.4784162142 -177.4016295239 133.76332841032 -188.1128313193 -316.93147439475        -1843.4968681712        -1849.5063106045        -773.44705540144        -625.94489071065        -217.88587770531        52.132413335371 -660.84263683815        -99.503660133662        -1159.6302171975        206.4167016395  -428.1130360796 853.91716304307 1445.9045242539 -296.25760527483        -390.15846168741        -218.30423288602        -609.3265750937 -803.96663506761        -805.5855656965 337.31518644613 568.83938461933 646.96683177904 933.30813801319 -477.66516349662        939.65987123018 -158.2381861742 -771.87401635971        -648.82870165421        -1045.5685183062        -753.91741407221        -456.89071433584        832.92027632834 -252.34618610295        4.6727910306289 161.37263775676 -148.97496535416        -554.05268298028        -324.03558999183        -611.2256475126 790.77712759137 -609.2195906069 424.55445713433 -496.04744561426        -261.15865712492274.6212303401  -38.326598588432        213.97975022815 -206.13793172626        137.89118723458 622.03251343382
    
-----------------------------
 ClassificationMetrics data  
-----------------------------
Threshold       : 0.5
Samples         : 400
----------------:------------
Pred.[0]/Act.[*]: 200   2
Pred.[1]/Act.[*]: 0     198
----------------:------------
Accuracy        : 99.5%
Precision       : 100%
Recall          : 99%
----------------:------------
FScore          : 99.5%
-----------------------------
    
-----------------------------
 ClassificationMetrics data  
-----------------------------
Threshold       : 0.5
Samples         : 400
----------------:------------
Pred.[0]/Act.[*]: 200   11
Pred.[1]/Act.[*]: 0     189
----------------:------------
Accuracy        : 97.25%
Precision       : 100%
Recall          : 94.5%
----------------:------------
FScore          : 97.17%
-----------------------------

Código example_perceptron_kernel_gaussian_circle.cpp:

#include <iostream>
#include <Pds/Ra>
#include <Pds/Ml>
int main(void)
{
Pds::Vector Yp;
Pds::Matrix F;
double Sigma=0.3;
// Generating data
unsigned int L=200;
Pds::Matrix X;
Pds::Vector Y;
Pds::Matrix G;
// Create Perceptron
G=X;
F=Pds::Kernel::Gaussian(X,G,Sigma);
Conf.SetMaxIter(10000);
Pds::Perceptron Neurona(Conf,F,Y);
Neurona.Print("\nNeurona:\n");
// Evaluate training data
Yp=Neurona.Evaluate(F);
// Metrics of training
Metrics.Print("\n");
// Evaluate testing data
F=Pds::Kernel::Gaussian(X,G,Sigma);
Yp=Neurona.Evaluate(F);
// Metrics testing
Metrics.Print("\n");
return 0;
}
La clase tipo Pds::ClassificationMetrics . Esta clase genera un bloque de datos para analizar curvas ...
La clase tipo Pds::IterationConf . Esta clase genera una matriz de Nlin lineas y 1 columna....
La clase tipo Pds::Perceptron . Esta clase genera una matriz de Nlin lineas y 1 columna....
Definition: Perceptron.hpp:63
static Pds::ClassificationMetrics Calculate(double Threshold, const Pds::Vector &Ypredict, const Pds::Vector &Yactual)
Crea un objeto de tipo Pds::ClassificationMetrics.
void Print(std::string str="")
Imprime en pantalla los datos de la estructura tipo Pds::ClassificationMetrics.
bool SetMaxIter(unsigned int MaxIter)
Coloca el valor MaxIter.
void LoadDataCircle(unsigned int L, Pds::Matrix &X, Pds::Vector &Y)
Clasificacion de datos separados por una curva.
Pds::Matrix Gaussian(const Pds::Matrix &X, const Pds::Matrix &G, double Sigma=1.0)
Crea una nueva matriz de "features" kernelizando de forma gaussiana.
void Print(std::string str="") const
Imprime en pantalla el contenido del vector de pesos después del texto indicado en str.
double Evaluate(const std::initializer_list< double > list) const
Evalua el objeto de tipo Pds::Perceptron.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed