Better NN EA development - page 64

 

The Comez code has problem with the classification there. It only does buy operation outside trained period. Tried to debug whole day, and still not get the real problem solved.

From the russian forum here, get the modified PNN eric code. it uses the parzen window classification. The results is so so from backtest.

As for any Parzen window classificator, your will have the sigma problem, what value for the sigma is best for current priod? I optimized it, and get the result 0.03 for EURUSD M15.

Files:
pnneric.mq4  6 kb
 

Link here is from codebase, he is using MACD and IMA matrix to calculate the Euclidian distance between trained vector and the test vector, good think so, need to be inproved. He is not using the parzen window classificator, but that just one step away.

What he is doing is he has a function that calcuate euclidean matric. So now we can go back to develope the PNNeric.mq4 above, to handle a matrix with iMA. Am I on the right track?

double Euclidean_Metric(double&X_Data_Base[][v_dim_x], double Vector[v_dim_x],int num_v)

{

int i=0,i1=0,i3,i2,i4;

double Metric[1];

double t,sum;

ArrayResize(Metric,num_v);

ArrayInitialize(Metric,0.0);

for(i=0;i<num_v;i++)

{

for(i1=0;i1<v_dim_x-1;i1++)Metric+=MathPow(X_Data_Base-Vector,2);

Metric=MathSqrt(Metric);

}

//sort by ASCEND Metric

for(i3=0;i3<num_v-1;i3++)

for(i2=i3+1;i2<num_v;i2++)

if(Metric>Metric)

{

t=Metric;

Metric=Metric;

Metric=t;

for(i4=0;i4<v_dim_x;i4++)

{

t=X_Data_Base;

X_Data_Base=X_Data_Base;

X_Data_Base=t;

}

}

sum=0;

for(i=0;i<Num_neighbour;i++)

{

sum+=X_Data_Base[5];

//Print(X_Data_Base[5]);

}

return(sum/Num_neighbour);

}
Files:
 

I found attached powerpoint presenation helped me understand more about parzen window classification.

Files:
dhsch4part1.zip  473 kb
 

attached is the parzen window classification functions for matlab

Files:
parzenpnn.zip  15 kb
 
 
Files:
 

Barnix,

İs it possible for you to combine Wavelet with KalmanGain: https://www.mql5.com/en/forum/176348/page4

 

Print Matrix elements script example

Files:
pnn_3_1.gif  14 kb
matrix1.mq4  2 kb
 

Normalize Matrix Columns (Script Example)

Files:
matrix2.mq4  13 kb
pnn_4_1.gif  15 kb
 

Normalize sample and test Matrices Columns (Script Example)

smple ATTRIBUTES --> sample MATRIX

test ATTRIBUTES --> test MATRIX

Files:
matrix3.mq4  13 kb
pnn_5a.gif  22 kb