3rd generation NN, deep learning, deep belief nets and Restricted Boltzmann Machines

Krzysiaczek99

Well-known member
Messages
430
Likes
1
The purpouse of this thread would be to verify if the deep belief nets trained for Restricted Boltzmann Machines can predict or classify FOREX strategies results. The comparative analysis with results obtained using Support Vector Machines with different kernels can be also done.

Deep belief nets seems to be quite new thing based on analysis of human brain way to work. Links to video tutorials are below

http://videolectures.net/icml09_bengio_lecun_tldar/
http://videolectures.net/mlss09uk_hinton_dbn/
http://videolectures.net/jul09_hinton_deeplearn/

The most research seems to be done by Mr. Hinton from Uni of Toronto and Mr Yann and Mr. Taylor from Uni of NY see links

http://www.cs.toronto.edu/~hinton/
http://www.cs.toronto.edu/~hinton/MatlabForSciencePaper.html

http://www.cs.nyu.edu/~gwtaylor/
http://www.cs.nyu.edu/~yann/

To achieve our goals we can use already existing FOREX system TradeFX which is using MATLAB + MT4 and using Support Vector Machines for classification

http://www.columbia.edu/~xv2103/finance/TradeFX/index.htm
http://www.columbia.edu/~xv2103/finance/TradeFX/Report.htm


For people interested in SVM theory here is very good video course

http://videolectures.net/epsrcws08_campbell_isvm/

So our tasks would be:


1) double check if all scripts of TradeFX are correct (already bugs found in three of them) and eventually expand this design by adding e.g. Buy Orders

2) Adapt the MATLAB code of Hintons autoencoder to be usable with TradeFX

3) Adapt the MATLAB code related to Phd Thesis of Taylor to be usable with TradeFX

4) Try to change standard MATLAB SVM kernel to different one (e.g. Wavelet)

Than back test and OOS test for systems from 2,3,4 can be done and results compared.

All code is dowloadable from links above

Questions are welcome

Krzysztof
 
Last edited:
Hi Krzysztof,
Thanks for starting this thread. Hope we get some help from members.
 
From someone who has tried the usual neural nets and found they didn't seem very good, I would be interested to know if these new nets give better results ?
 
From someone who has tried the usual neural nets and found they didn't seem very good, I would be interested to know if these new nets give better results ?

Indeed...that is the question:
Whether 'tis nobler in the mind to suffer
The slings and arrows of outrageous fortune,
Or to take arms against a sea of troubles
...etc (thanks, Bard)

This a very thought provoking (yes, computer, pun intended), and somewhat intimidating exercise. A little too late to do anything today, so

To sleep: perchance to dream

and then, maybe tomorrow, we will think on

The undiscover'd country from whose bourn
No traveller returns, puzzles...


Dude, this poetry is a rush, you can read anything you like into it
 
In all seriousness, thanks to Krzysiaczek for this very thought provoking post. I dread to think what you are like at chess.
 
Listened to the first few minutes of one of these out of curiosity..and I have to say it sounds like a pile of sh1t..... deliberately vague and pseudo -complicated ..maybe it gets better further on in...anyone else have more patience ?
 
Listened to the first few minutes of one of these out of curiosity..and I have to say it sounds like a pile of sh1t..... deliberately vague and pseudo -complicated ..maybe it gets better further on in...anyone else have more patience ?

Oddly, that is a very precise description of my response to technical analysis.
 
Or to take arms against a sea of bubbles
...etc (thanks, Bard)


err thx
haven't a clue what he's on about
 
You should not waist your time on this kind on nets. I have implemented several kinds and realized that the reasons they work so well at classifying stuffs are the very reasons they don’t work when applied to markets:

They are very sensitive to the number and the size of layers which make them impractical in market environments.

For the training stage to converge properly they need many thousands input occurrences:
- Even in optimized C++ training takes several hours,
- Even with feature extraction, it is hard or even impossible to find such high number of input occurrences from market data.

These networks have several hundred million neurons the majority on them placed on the first layer. The reason Deep networks work so well in classification is that they encode each possible solution to the problem in the first layer. It is then just a matter to pick the most appropriate one from higher level representations just as it happens in the brain. Deep networks fit the problem at hand very well though raising the question of generalization. Neural nets do not adapt but I was expecting them to pick recurrent market states so that I could trade the deviation. Well, it was quite a disappointment for me to realize that they don’t. It was argued that deep networks infer new solutions after learning but I did not see it.

My conclusion after 3 years investigating deep architectures. They are not appropriate to trading at the moment. To address the generalization issue we need incremental versions with online learning. I am currently looking into dynamic factored structures which use similar RBM building blocks. I believe they are more promising but still in a very early stage of development.

My advice: carry out due diligence before spending time on this.

My 2 pips.
 
Krzystof has noticed several bugs in the TradeFX programs instantpip.m, instantpipexit.m, and explosivepip.m. These all involve future leaks in which a future price is used to make a current calculation. I assume that he will eventually propose fixes for these bugs.. in fact he has below.

I am concerned with future leaks caused by the use of open prices as entry and exit prices when the conditions causing entry and exit depend on closing prices. This is a massive future leak, and means that all of the TradeFX conclusions about the performance of the strategies must be re-tested. This can be fixed by using closing prices instead of open prices for entry and exit.

This post is intended to warn members that the code in TradeFX should be examined very carefully before it is used.(n)

As these bugs are removed we can begin testing the hypotheses in the TradeFX papers.

Welcome to you thread-poets. Hope that you contribute comments or code as well as poetry. :)
 
Last edited:
TradeFX bugs

Here are three bugs what i found in TradeFX scripts

1) Future leak from InstandtPip line 64

Code:
64        cond(2) = high(t+1) < high(t) && low(t+1) > low(t);
index t+1 is used what is not allowed


2) code in instantPipExit lines 50-71

Here index t+2 is used. So limit and stop vars are based on this index


Code:
stop = price(t+2);
    if high(t) > stop
        stop = high(t);
    end
    limit = price(t+2) - LIMIT;
   
    cond = zeros(1,3);
    exitTime = 0;
    status = -1;
    for i = t+1:length <------ !!!!! but here it start from t+1
        cond(1) = pSAR(i) < close(i); % parabolic SAR below
        cond(2) = within(lwBol(i),price(i));
        cond(3) = (price(i) > stop) || (price(i) < limit);
        if sum(cond) >= 1
            exitTime = i;
            break;
        end
    end
so you can not compare data t+1 with data t+2 (stop and limit) because t+2 is in the future and you don't know it !!!!! it is future leak

in this code cond(3) = (price(i) > stop) || (price(i) < limit); loop is running over all prices but stop/limit don't adjust to new prices because of fixed t at this moment


3) Future leak from explosivePip line 72.

Code:
72   cond(3) = open(t+1) < close(t); % price breaks
index t+1 is used what is not allowed

Comments are welcome. Maybe somebody will find another bug so please post it

Krzysztof
 
Initially I wondered why we use the SVM on such apparantly trivial estimation problems. Bayes shows us that the best decision we can make uses the conditional pdf p(y/x) where y is output and x is input. So in effect, we are using the SVM to estimate this pdf. Another way to estimate it would be to count the number of times x results in y (Num(y/x)), and count the number of times x occurs. Then a good estimate i s Num(y/x)/Num(x). This is probably pretty good if we have 60 counts or so in each counting bin. So, for 1000 samples, as used in these examples, we could accommodate maybe 16 bins.

In fact, for the Explosivepip strategy there are only 3 conditions and 2 outputs, so we would need only 16 bins, and 1000 samples are probably enough.

However in the pipMaximizer strategy there are 9 conditions and 2 outputs, so we would need 256 bins, and with 1000 samples we have only 4 counts in each bin on average, so the estimate would probably be poor indeed if the pdf is at all spread out.

It would be interesting to compare the performance of an SVM to a histogram at least for the ExplosivePip strategy.

We might simply use more samples and return to counting things, but then we might run up against the inherent non-stationarity in Fx series. By the time we got to 25600 samples we might have lost the local pdf, and find only a pdf averaged over too much time. So maybe the SVM is a good idea after all. It will be a particularly good idea if we ever get to continuous inputs and outputs.

Incidentally, I have been trying to understand the hasline.m code. It seems to me that this is a count of the number of bars that cross a line defined by the mid of a bar. This is not the same as the article referenced in the code comments, where the idea is to find price lines with the minimum number of crossings. Furthermore, the result is counted over a period from 1 to t-1 which increases with t. So as t increases this count will increase, and the likelihood that it will exceed M will increase, until after a couple of hundred samples it seems that this indicator is very likely to be 1 and carry no information. Can someone check me on this please?
 
Indicator builder uses open for BBands and all MA's. If we use close for entry/exit (as we should) then I suggest that all indicators use close as input.
 
Listened to the first few minutes of one of these out of curiosity..and I have to say it sounds like a pile of sh1t..... deliberately vague and pseudo -complicated ..maybe it gets better further on in...anyone else have more patience ?

:D

I like the way you circled the problem and then decided to call a spade a spade!

They'll be feeding us prawnsandwiches next!
 
Indicator builder uses open for BBands and all MA's. If we use close for entry/exit (as we should) then I suggest that all indicators use close as input.

Yes it must be changed otherwise is a mess for example in this code
he compares pSAR with Close and checks MACDSign which is calculated on Open

Code:
cond(1) = pSAR(i) < close(i); % parabolic SAR below
            cond(2) = (price(i) > stop) || (price(i) < limit);
            cond(3) = (MACDSign(i)) > 0 && (MAhist(i) > 0); %TODO: cross over above

I will make a document where i will collect all changes and solutions
 
You should not waist your time on this kind on nets. I have implemented several kinds and realized that the reasons they work so well at classifying stuffs are the very reasons they don’t work when applied to markets:

They are very sensitive to the number and the size of layers which make them impractical in market environments.

For the training stage to converge properly they need many thousands input occurrences:
- Even in optimized C++ training takes several hours,
- Even with feature extraction, it is hard or even impossible to find such high number of input occurrences from market data.

These networks have several hundred million neurons the majority on them placed on the first layer. The reason Deep networks work so well in classification is that they encode each possible solution to the problem in the first layer. It is then just a matter to pick the most appropriate one from higher level representations just as it happens in the brain. Deep networks fit the problem at hand very well though raising the question of generalization. Neural nets do not adapt but I was expecting them to pick recurrent market states so that I could trade the deviation. Well, it was quite a disappointment for me to realize that they don’t. It was argued that deep networks infer new solutions after learning but I did not see it.

My conclusion after 3 years investigating deep architectures. They are not appropriate to trading at the moment. To address the generalization issue we need incremental versions with online learning. I am currently looking into dynamic factored structures which use similar RBM building blocks. I believe they are more promising but still in a very early stage of development.

My advice: carry out due diligence before spending time on this.

My 2 pips.

Very interesting mail. Is your research a public domain ?? Is it possible to have a look ??
What sort of models you examined ?? Did you try Hilton's autoencoder model with pretraining, training and fine tuning ?? What learning algorithms you used ??

Krzysztof
 
Top