:: AForge.NET Framework :: Articles :: Forums ::

## Resul Expression of the Time Series Prediction with GP

The forum is to discuss topics from different artificial intelligence areas, like neural networks, genetic algorithms, machine learning, etc.

### Re: Resul Expression of the Time Series Prediction with GP

dobdo99 wrote:What is the relationship between constants and the time series functions?

The time series function, which is found by GP algorithm, will consist of past values (like x[t-1], x[t-2]) and constants which you've specified. As you've already seen before, one of the solutions for one of the time series you had was x[t-1] + 2, where "2" is a constant selected from the list you gave.

dobdo99 wrote:why do we have these specific numbers as constants?

You can actually choose any numbers you like. Just keep in mind that you specify limited amount of constant, so you better choose those, which can be used to easily create other possible constants. For example, suppose you have a time series like x[t-1]+6. As you can see from the code, "6" is not in the list of constants. But GP algorithm can create it quite easily using "2*3", which are available. Of course there are some functions available, like ln, sin, cos, exp, etc., which can be also used in GP expressions.
With best regards,
Andrew

Interested in supporting AForge.NET Framework?

andrew.kirillov

Posts: 2693
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

### Re: Resul Expression of the Time Series Prediction with GP

Andrew many thanks

I just thought it was a "magical property" of prime numbers! or is that just coincidence?
sorry for the real basic questions:
I'm an empirical guy, I Like to "do", "to prove" manually.

I'm trying to return the predicted next value in the sequence using:

variables = data []
string function = "\$6 \$0 +";
double ret = PolishExpression.Evaluate(function, variables);

Where do the constants come into this? or is there another function? or do I need to write my own?

Or...................... I think I have got it wrong again!
dobdo99

Posts: 4
Joined: Mon Mar 05, 2012 7:51 pm

### Re: Resul Expression of the Time Series Prediction with GP

So Andrew let me know if I understood correctly...
With a window size equals to 5, all variables that starts from \$5 and up are constants, where \$5 is the first previously declared constant and so on..

\$0 = X(t - 1)
\$1 = X(t - 2)
\$2 = X(t - 3)
\$3 = X(t - 4)
\$4 = X(t - 5)

But X(t - 1) means x*(previous value - 1) ??
Am I wrong??

Thank you
vincenzodentamaro

Posts: 9
Joined: Mon Feb 27, 2012 4:28 pm

### Re: Resul Expression of the Time Series Prediction with GP

vincenzodentamaro wrote:But X(t - 1) means x*(previous value - 1) ??
Am I wrong??

If you are doing prediction of X(t) value of a time series, then X(t-1) means previous value of the time series.
With best regards,
Andrew

Interested in supporting AForge.NET Framework?

andrew.kirillov

Posts: 2693
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

### Re: Resul Expression of the Time Series Prediction with GP

Ok thank you!!
vincenzodentamaro

Posts: 9
Joined: Mon Feb 27, 2012 4:28 pm

Previous