Better NN EA development - page 71

 

Sorry, OTR -

I didn't realize you guys have been using updated PNN library. Didn't pay much attention, my bad.

So, it still unclear to me - does your code fix the problem you mentioned or not? Thanks for the efforts.

OnTheRoad:
Hi Dear Orest,

the fx after calculation will result numeric >= 0

thus it will be > -99999999999999999999 all the times ,

thus it will return 0 or 1 for classification and -1 will not returned at all,

,

I attached the verified version PNN3,

#define TOTAL_CLASS 2

#define NON_CLASS -100

#define CLASS_RATIO 10

double aux ;

double myvar[TOTAL_CLASS] ;

int classes[TOTAL_CLASS] ;

int myi;

for (i = 0; i < TOTAL_CLASS ; i++) classes = i ;

for (i = 0; i < ArrayRange(fx, 0); i++)

{

//fx *= 1 / (MathPow(2 * 3.14159265, length / 2) * MathPow(SIGMA, length)) * (1 / classVectorCount);

fx *= ( 1 / classVectorCount ) ; //* ( 1 / (MathPow(2 * 3.14159265, 0.5 ) ) ) * MathPow(SIGMA, length)) * ;

myvar = fx ;

}

for (i = 0; i < TOTAL_CLASS; i++) // sorting ( descending ) for finding the largest result in myvar[] and its class_num in classes[]

for(j = i+1 ; j < TOTAL_CLASS ; j ++ )

{

if ( myvar < myvar[j] )

{

aux = myvar ;

myvar = myvar[j] ;

myvar[j] = aux ;

myi = classes ;

classes = classes[j] ;

classes[j] = myi ;

}

}

resultClass = NON_CLASS ;

// this is the default return value

if ((myvar[0] > CLASS_RATIO * myvar[1])&& (myvar[0] > result))

// myvar[0] is the largest result and it will checked by myvar[1] for

// enough difference (10 times) to be considered as winner class. it can be done by proper selection of SIGMA but I haven't check yet....

{

resultClass = classes[0];

}

please test it

thanks

OTR
 

Pnn3

Hi Orest,

PNN3 is primary fixing of classification by using the:

accepting the winner class if its calculation results is 10 times more than other class.

example : if fx[0] = 0.57 and fx[1] = 0.56 in old compare the winner will be fx[0] (0.57>0.56) , but this is not enought difference to win a class,

in new pnn3 , this will generate NON_CLASS ,

the CLASS_RATIO=10 is used for finding the calculations that generate more difference and better winner class eg: fx[0] = 0.57 , fx[1]= 0.05 (0.57>10*0.05) then fx[0] is the winner class

also I offer using a minimum acceptance criteria for winning class : example : MIN_ACCEPT_LEVEL = 0.3333

if the class calculation result is less than this level then it will not be a winner class,

it needs more testing.

and a Q: what are the rules of proper selection of SIGMA (its preset is 1 ?)?

thanks

OTR

 

Great job, OTR - what can I say?

Did you touch any other code (teacher, main EA) other then pnn class? I'm kinda unhappy about existing inputs. Inputs are very basic, if I have time I'll probably play with that.

About SIGMA. From my understanding SIGMA is what you optimize to get better results. I know now it's in PNN library class and you could do nothing about it, but potentially it could be used as external parameter in main EA and passed to PNN functions as a parameter. As we all know no EAs show good results in a long run, market changes all the time. SIGMA is what we could use as an optimizer.

Orest

OnTheRoad:
Hi Orest,

PNN3 is primary fixing of classification by using the:

accepting the winner class if its calculation results is 10 times more than other class.

example : if fx[0] = 0.57 and fx[1] = 0.56 in old compare the winner will be fx[0] (0.57>0.56) , but this is not enought difference to win a class,

in new pnn3 , this will generate NON_CLASS ,

the CLASS_RATIO=10 is used for finding the calculations that generate more difference and better winner class eg: fx[0] = 0.57 , fx[1]= 0.05 (0.57>10*0.05) then fx[0] is the winner class

also I offer using a minimum acceptance criteria for winning class : example : MIN_ACCEPT_LEVEL = 0.3333

if the class calculation result is less than this level then it will not be a winner class,

it needs more testing.

and a Q: what are the rules of proper selection of SIGMA (its preset is 1 ?)?

thanks

OTR
 

New Offer : Proper input selection for NN/PNN + dynamic period selection

Hi dear contributors,

thanks Orest,

we all have seen that the certain indicators were worked good in some times and failed in other times , eg : RSI14_1D , EMA50_1H , EMA62_1H , CCI_14_1H , CCI34_15m , STOCH_5.3.3_1D ,....

the basic matter that we must consider is this: the price pip movements amount will generate price_action/profit/Loss , no the solid period of Indicators,

the other subject is that the big institutions work on price levels and existing supply/demand volume in market for their totally/partially entry/exit in market.

thus:

1- the main inputs for our networks must be based on price levels / price movements , not a solid indicators based on const periods. (SR , PIVOTS , FIB , FIB_EXPAN , ROUND_NUMS , ...)

2- we need to map a good picture of price_action around these levels as market finger_print for our classification purpose. thus we will have:

mapping a variable time_window of data to constant_input_count of Network by selection of proper data from longer/shorter sampling time_window. (longer sampling time for slow market , shorter sampling time for fast market )

3- if we are feeding the indicators as input to network, we need to correlates their periods to price movements , i think the indicator that we can use by const period is ATR_DAILY_11 (22) period that shows the avg trading range of 11/22 recent trading days (i have read/think 11/22 days is the basic market cycle)

or ATR_4H_18 (30) (3day or 6day).

thus we can select :

INDICATOR_period ~= a + b * 1 / (c+ATR_XX_nn) : a , b , c must be defined,

this means if the market is slow and low range , we must expand INDI_PERIODs and vice versa,

this the road map that i am working on it for PNN,

please verify me if you see any thing in these notes.

thanks

OTR

 

more expalnation:

here are some more explanation:

suppose we calculated/extracted nearest SR , PIVOTS , FIBs , ROUND_NUMs ..

and drawn them in chart, and we see the price action around these levels,

suppose this is a bitmap picture that right part of it (next future candles) are lost, and our system already saved many sample pictures (trained vectors),

now we want to feed this picture data to network and want to find the most similar pictures of its data bases (classes that meant most probable next future candles price action),

for feeding this picture to network we can reduce the data by selecting proper parts of it (it means smaller network input count or smaller "pattern vector size")

i want to find an approach for finding proper parts of data (= effective parts)

like those circled in green,

what does mean other parts of chart (uncircled) ?

they are the hold_position/add_position part of operation.

OTR

Files:
 

OTR, if you want to identify the extremums (circled hi/los on your chart) you need to use another PNN. This one is just based on success/unsuccess of a random trade. The trade most likely would start before your hi/low and will be exited after it. Another way to feed the network is to store N last candles (each candle as a code depends on it's configuration).

OnTheRoad:
here are some more explanation:

suppose we calculated/extracted nearest SR , PIVOTS , FIBs , ROUND_NUMs ..

and drawn them in chart, and we see the price action around these levels,

suppose this is a bitmap picture that right part of it (next future candles) are lost, and our system already saved many sample pictures (trained vectors),

now we want to feed this picture data to network and want to find the most similar pictures of its data bases (classes that meant most probable next future candles price action),

for feeding this picture to network we can reduce the data by selecting proper parts of it (it means smaller network input count or smaller "pattern vector size")

i want to find an approach for finding proper parts of data (= effective parts)

like those circled in green,

what does mean other parts of chart (uncircled) ?

they are the hold_position/add_position part of operation.

OTR
 

Parzen Classifier

i read this 311: Neural Networks

at end sample recognition Iris Setosa/Iris Versicolour/Iris Virginica

using the calculator.

who can explain how to make the normalization ?

(6.3, 2.7, 5.0, 1.8) which after normalization becomes: (0.75 0.32 0.6 0.21)
 
sae2k:
i read this 311: Neural Networks

at end sample recognition Iris Setosa/Iris Versicolour/Iris Virginica

using the calculator.

who can explain how to make the normalization ?

I remember working through this example and I think its probably normalised by subtracting each value from its mean and then dividing by the standard deviation. IIRC Barnix posted a PDF somewhere on this thread that deals with different techniques for normalisation.

 
zupcon:
I remember working through this example and I think its probably normalised by subtracting each value from its mean and then dividing by the standard deviation. IIRC Barnix posted a PDF somewhere on this thread that deals with different techniques for normalisation.

and can be a formula?

 
sae2k:
and can be a formula?

first you need to get a copy of the iris database containing all of the data, I think there are around 400 records for each type of plant, someonne may have already posted that on this thread, but if not its a standard dataset used by AI reseachers and its easy to find, most university websites will have a copy someplace.

Then you calculate the mean and standard deviation for each attribute, the easiest way is to use stats functions in excel. I honestly cant remember if you find the mean for each iris type, or a mean for the whole population, but it'll only take 2 mins to check both methods

Then you use those means and standard deviations to normalise, the formula to normalise an attribute is Normalised Value = (X-Mean)/Sigma

I think you need to normalise each record in the data set, and of course each record you are trying to match.

Beware, there are few different ways the data could be normalised, the PDF Barnix supplied details the most common methods, but I'm pretty sure the examples I've seen posted on this thread use the simple method I've described.

Also beware that some of the papers and websites that containin this iris example do contain some errors in the calculations, and these error seams to have been copied by several authors, so some of your numbers may be a little different as you work through each stage of the calculation, but I think the final numbers are correct.

I have a spreadsheet at home with a worked example that I could post, but unfortunately I'm travelling for the next few weeks and wont be able to post it until I get back. The normalisation puzzled me for a while, but once I'd worked it out everything quickly fell into place. Its well worth taking the time to understand how these things can be used

Reason: