Forex Factory (https://www.forexfactory.com/forum.php)
-   Platform Tech (https://www.forexfactory.com/forumdisplay.php?f=69)
-   -   My most recent advancements into machine learning (https://www.forexfactory.com/showthread.php?t=181358)

Ronald Raygun Jul 8, 2009 2:47pm | Post# 1

My most recent advancements into machine learning
 
Hey guys, I'll come up with a more detailed explanation of my experiences at RBS, but for those going into neural networks and other forms of machine learning, I suggest you go through these three websites.

http://www.cs.ucf.edu/~kstanley/
http://gar.eecs.ucf.edu/
http://nerogame.org/

These three websites explain to an extent a new application of genetic networks. I'm currently doing some research in conjunction with University of Texas and Columbia University to develop a testing model for forex. Here are the two models we are testing:

Model 1

Phase 1: Initial Seeding
During this phase, I just threw four different trading systems:

 

  1. Trending
  2. Ranging
  3. Scalping
  4. Backpropagation network.

I then had all of them run against one year of data. The system then picks the system with the highest success score (see my signature "How I Rate Trading Systems").

Phase 2: Evolution
During this phase, the system looks at the past performance of Phase 1, and then moves forward in one-week increments. During every week:

 

  1. Backtest to get the success score
  2. Pick system evolution with the highest success score
  3. Mutate/Evolve the systems which lost.
  4. Go to step 1

I have gone through 77 weeks and generations so far. There are a total 43 offspring in this current generation. Average success score is about 160, ranging from 50 to 200.

Model 2

Phase 1: Initial seeding
Straight coin toss is used. Heads long, tails, short, which trains the network. Network is trained to try and predict whether the market will first hit 10 pips long, or 10 pips short.

Phase 2: Evolution
After the intial seeding, every tick will be given a prediction, and a likelihood score.

Example:

Current bid: 1.23456
Long Score: 80 (out of 100)
Short Score: 20 (out of 100)

This means that the NN thinks that the price has an 80% chance of going up 10 pips before doing down 10 pips. Once the price moves 10 pips, the NN generates two offspring, and tests again, discarding whichever one was wrong.

The success score of this model is around 90.

Obviously, the first project is starting to show more promise, and I would love for there to be a competing project hosted here on ForexFactory (Oh Twee-ee...).

Anyway, have a look around. I would love to see how the FF community evolves this project =D

Craig Jul 8, 2009 4:16pm | Post# 2

This is interesting stuff, I was looking though some of these papers about a year ago, it certainly solves the problem of the best network topology and doing the evaluation genetically means one does not have to write all sorts of nasty equations to perform a gradient decent/ascent. Anything which cuts down the number of free parameters is a good thing. The only problem with reading the literature surrounding AI & trading is that they always evaluate their systems in such a hopelessly naive way (e.g. trying to predict the direction of the next bar, for example).

Ronald Raygun Jul 8, 2009 4:36pm | Post# 3

From what I've read of the research paper, the idea behind the NEAT method is baby steps.

For example, you do not try to teach a newborn child stochastic calculus the day he/she's born. You follow a sequence:

 

  1. Teach the child to communicate with you
  2. Teach the child addition/subtraction
  3. Teach multiplication/division
  4. Teach geometry
  5. Teach trigonometry
  6. Teach algebra
  7. Teach calculus
  8. and so on

The progression I intend to go on is fairly basic and should be simple enough:

 

  1. Calculate likelihood of the price moving 10 pips in the chosen direction
  2. Calculate likelihood of the price moving x pips in a given direction
  3. Predict the direction of the next bar.
  4. Predict the size of the next bar
  5. Predict both the size and direction of the next bar
  6. Predict the high of the next bar.
  7. and so on.

I don't expect to be right 100% of the time, but the closer I get, the more valuable this is to me.


Ronald Raygun Jul 8, 2009 5:12pm | Post# 4

To elaborate, look at the evolution of this drawing on this website: http://www.cs.utexas.edu/users/kstanley/rocket.html

Ronald Raygun Jul 8, 2009 5:39pm | Post# 5

Here's the software to make your own drawings.

http://sephi.dotnet-expert.de/Blog/P...2-be5d481dbc0f

BlackMage Jul 9, 2009 6:12pm | Post# 6

I did some experimenting with NEAT a couple of years ago. I did like the idea behind it, but it is slooow and impossible to use on large data sets (unless you got some serious cluster running it). The general problem with applying concepts from machine learning to trading is that no learning algorithm can learn anything reasonable if there is no information contained in the data. Furthermore it is very difficult to teach an algorithm how the underlying forces that moves the market works.

It all boils down to what inputs are chosen and how the outputs are interpreted (ya know - garbage in = garbage out). If the inputs are sound then any learning algo should be able to get something usefull out of it.

IMO one is better off by having a well developed underlying algorithm which exploits some kind of edge and then optimize it by an overlying machine learning layer.

Fulltime247 Jul 9, 2009 6:18pm | Post# 7

I actually think RR's approach is valid because the underlying trading systems will work in the type of markets the specialize in (ranging, trending..) - Its just a matter of teaching the system when to use the proper system. He's not trying to teach the system HOW to trade just when to use the right system - A MUCH smaller task.

BlackMage Jul 9, 2009 6:20pm | Post# 8

I have gone through 77 weeks and generations so far. There are a total 43 offspring in this current generation. Average success score is about 160, ranging from 50 to 200.
In-sample or out-of-sample?

Ronald Raygun Jul 9, 2009 6:21pm | Post# 9

Blackmage:

The difference between today and a few years ago is I now have OpenCL and CUDA. In other words, I'm using graphics cards in addition to my CPU. So, I get far more performance than with hardware from pre 2007. I'm seeing easily a 10-fold increase in my computing power for this particular task.

As for those generations, they are in-sample.

Fulltime:

You got it!

BlackMage Jul 9, 2009 6:24pm | Post# 10

I actually think RR's approach is valid because the underlying trading systems will work in the type of markets the specialize in (ranging, trending..) - Its just a matter of teaching the system when to use the proper system. He's not trying to teach the system HOW to trade just when to use the right system - A MUCH smaller task.
Your right - I think I misread his first post.

Ronald Raygun Jul 13, 2009 9:23am | Post# 11

A little more 'NEAT' stuff.

http://nn.cs.utexas.edu/pages/research/neatdemo.html

http://www.cs.ucf.edu/~kstanley/demos.html

pengkwai Jul 13, 2009 9:30am | Post# 12

Thank you for the links. I found the links very informative and interesting.

yohan_ip Aug 17, 2009 1:46am | Post# 13

Please do kindly mentor me :)
 
Hi Ronald, the thread is very awesome..if you don't mind please do kindly mentor me by answering the questions.. on how did you scale the data series(the prices)? a code snippet would be delightfull

Thank you

bossxero Sep 15, 2009 3:05pm | Post# 14

http://picbreeder.org/index.php

maxss280 Dec 7, 2012 11:16am | Post# 15

1 Attachment(s)
Hi Ronald,

Here is my latest attempt.
5991 samples
28 predictors

No pre-processing
Resampling: Bootstrap (25 reps)

Summary of sample sizes: 5991, 5991, 5991, 5991, 5991, 5991, ...

Resampling results across tuning parameters:

size decay RMSE Rsquared RMSE SD Rsquared SD
1 0 0.0772 0.765 0.0452 0.379
1 0.001 0.0302 0.947 0.0432 0.127
1 0.01 0.0616 0.831 0.0494 0.149
1 0.1 0.00715 0.995 0.00062 0.000766
3 0 0.0264 0.981 0.0406 0.067
3 0.001 0.0102 0.984 0.019 0.0618
3 0.01 0.0113 0.984 0.0197 0.0533
3 0.1 0.00721 0.995 0.00068 0.000818
7 0 0.00606 0.997 0.000849 0.0011
7 0.001 0.00594 0.997 0.00098 0.00135
7 0.01 0.00586 0.997 0.00057 0.000662
7 0.1 0.00734 0.995 0.000477 0.000643
15 0 0.00597 0.997 0.000718 0.000867
15 0.001 0.00646 0.995 0.00322 0.00791
15 0.01 0.00575 0.997 0.000448 0.000532
15 0.1 0.00742 0.995 0.000402 0.000561

RMSE was used to select the optimal model using the smallest value.
The final values used for the model were size = 15 and decay = 0.01.

Attached is a graph of the test data. The red line is the prediction based on the model it is shifted 6 steps to the left.
Fairly accurate model considering the test data was not included in the trainging and counts for roughly 15% of the totally dataset.
Name:  Rplot.png
Views: 2424
Size:  4 KB

Ronald Raygun Dec 10, 2012 1:22pm | Post# 16

Impressive.

But how far forward are you able to look?

maxss280 Feb 28, 2013 8:41pm | Post# 17

I believe that model was only predict the next future bar. It did not prove to be very useful though. After examining the output data a bit more the values giving were very close to the previous bars but not much further form the last bar. Sure did give the impression that it was close after running all the numbers. But as being profitable not so much.

I stumbled upon some more promising work with SVMs I hope to get some time to take a better look at in the future.
http://www.quintuitive.com/2012/12/1...s-performance/

Near the bottom it has a comparison between the classification and regression strategies using RSI's as input.


© Forex Factory