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

Highfreq

Junior member
47 2
So are you using this autoencoder setup with pretraining and fine tuning ?

Did you or somebody else try Convolutional Neural Networks for market data ??

Krzysztof
Contrastive divergence as pretraining and conjugate gradients as fine tuning.

I also looked into convolutional nets with not much luck either. They seem to lend themselves to online updates better though. Here is some source code made public if you want to look into:
http://www.codeproject.com/KB/library/NeuralNetRecognition.aspx
http://www.inf.ufsc.br/~otuyama/eng/academic/cnn/index.html
 

Highfreq

Junior member
47 2
I don't see why an online version could not be done. Conceptually you could do it with two Dll's, one to train and one to classify as follows:
Arrays/structures:
Rates array.. contains OHLCV for each bar
Target array..contains results if entry on a given bar
Input array
Net
MT4
Allocates memory for all structures (This is so that strategy tester will work. )
Maintains rates and Target array
Calls Net_Train with pointers to arrays
Calls Net_Classify with pointers to arrays
Uses result to trade
Net_Train
Calls feature_builder to build input array
Uses target array to label input array
Trains Net
Net_Classify
Calls feature_builder to update input array
Applies net to determine prediction
Feature_Builder
Calculates input to net .. indicators, conditions to build input array

Operation:
MT4 initializes the net by calling Net_Train
At end of each bar:
If a new label has been determined, MT4 calls Net_Train to update input array and retrain the net.
MT4 calls Net_Classify to get a prediction
MT4 makes appropriate trading decisions.

This all assumes that a net_train dll could run in 1 bar time. If not, then the training would have to go on in the background while new input was collected. Would require some double buffering.

Those are intriguing pictures of hidden structure.:clap: What is the nature of the input price patterns, and the DBN used to find them? I assume unsupervised learning for this level?
I fed the net with 2D image representations of the patterns. For the example below I used cycles that fit price well in the first part of the pattern but degrade in the second part. Next I attached a label to each of these patterns by looking for cycles that fit well the second part. These classes of patterns capture a switch of the cycle. To make the network happy I had to generate tons of surrogates from these patterns making sure there were no ambiguities between the classes. Below, I show 2 features from the net. See how the feature on the right has rotated clockwise. They indicate that price has switched to a larger time-frame. Now the remaining problem is not an implementation issue but I did not figure out yet how to make an online version for the training phase that would provide nicely evolving features.
 

Attachments

fralo

Active member
104 0
I fed the net with 2D image representations of the patterns. For the example below I used cycles that fit price well in the first part of the pattern but degrade in the second part. Next I attached a label to each of these patterns by looking for cycles that fit well the second part. These classes of patterns capture a switch of the cycle. To make the network happy I had to generate tons of surrogates from these patterns making sure there were no ambiguities between the classes. Below, I show 2 features from the net. See how the feature on the right has rotated clockwise. They indicate that price has switched to a larger time-frame. Now the remaining problem is not an implementation issue but I did not figure out yet how to make an online version for the training phase that would provide nicely evolving features.
How much of the process required manual intervention?

What do you mean by cycles? There are so many discussions of cycles derived from FFT's, Goertzel, etc. but I think you mean something else.

How do you know when a network is happy? If you can distill that info, I'll buy a can or two. I still don't know when my wife is happy, and I've been married for many years.:LOL:
 

Krzysiaczek99

Well-known member
430 1
Some TradeFX results

Here is some TradeFX results obtained using attached EURUSD 1m file for instantPip strategy. I was changing the value of cutpoint variable between 2500 - 400.

For explanation: cutpoint 400 means 400 OOS bars and 400 training bars, cutpoint 1000 means 1000 OOS bars and 1000 training bars

cutpoint accuracy, total profit, number of trades

2500 62.7 0 0

2000 64.2 -0.8 54

1500 62.86 -82.7 276

1000 58.5 12.9 244

400 64 50.8 92

so intial conclusion is that for using SVM in predicting trade strategy results accuracy is quite high 58-64 %. It also shows that the prediction time horizon is quite short. As this strategy makes sell orders only more tests like this on different data sets must be done to avoid 'lucky' results.

Krzysztof
 

Attachments

Last edited:

intradaybill

Well-known member
358 14
NNs of any kind are elaborate schemes for curve-fitting and nothing more than that.
 

Highfreq

Junior member
47 2
How much of the process required manual intervention?

What do you mean by cycles? There are so many discussions of cycles derived from FFT's, Goertzel, etc. but I think you mean something else.

How do you know when a network is happy? If you can distill that info, I'll buy a can or two. I still don't know when my wife is happy, and I've been married for many years.:LOL:
The cycle part is now automated. I use it in my trading. The cycles are from a third party package for Neuroshell. It's better than FFT in that it is data aware. Bandpass filters are computed from volatility itself.

Well, it will be wine for me. I am getting intimate with my nets. I figure they are happy when they make me happy. For sure DBNs need a lot of training samples before the features exhibit some structure. They settle very slowly...........
 

Highfreq

Junior member
47 2
Re: Some TradeFX results

Here is some TradeFX results obtained using attached EURUSD 1m file for instantPip strategy. I was changing the value of cutpoint variable between 2500 - 400.

For explanation: cutpoint 400 means 400 OOS bars and 400 training bars, cutpoint 1000 means 1000 OOS bars and 1000 training bars

cutpoint accuracy, total profit, number of trades

2500 62.7 0 0

2000 64.2 -0.8 54

1500 62.86 -82.7 276

1000 58.5 12.9 244

400 64 50.8 92

so intial conclusion is that for using SVM in predicting trade strategy results accuracy is quite high 58-64 %. It also shows that the prediction time horizon is quite short. As this strategy makes sell orders only more tests like this on different data sets must be done to avoid 'lucky' results.

Krzysztof
Interesting post! It would be interesting to see how your system behaves on ranging markets... My experience with SVMs is that they give similar results than NN-based classifiers. SVMs are good though because they are less prone to overfitting. That might partly explain your results.
 

Highfreq

Junior member
47 2
NNs of any kind are elaborate schemes for curve-fitting and nothing more than that.
Let me quote StratOpt

There is absolutely nothing wrong with curve fitting. The only danger in optimizing is if you allow an overfit. Optimizing is only one part of a testing equation. In all reality, If you develop a strategy of any kind and it has a parameter or any other rule in which you make a choice as to what setting or rule to use then you have already curve fit before you begin any optimization. So yes you are curve fitting and yes genetic optimizers are a "fancy" way of doing such, and yes that is what they are designed to do. Again, there is nothing wrong with any of that. I have been very successfully incorporating such things into my development and testing and trading for quite a long while now and can't imagine not using them and remaining successful with any sort of programmatic strategy trading.

http://www.trade2win.com/boards/tradestation/101792-ts-add-ons-strategy-development.html#post1229142
 

Krzysiaczek99

Well-known member
430 1
I fed the net with 2D image representations of the patterns. For the example below I used cycles that fit price well in the first part of the pattern but degrade in the second part. Next I attached a label to each of these patterns by looking for cycles that fit well the second part. These classes of patterns capture a switch of the cycle. To make the network happy I had to generate tons of surrogates from these patterns making sure there were no ambiguities between the classes. Below, I show 2 features from the net. See how the feature on the right has rotated clockwise. They indicate that price has switched to a larger time-frame. Now the remaining problem is not an implementation issue but I did not figure out yet how to make an online version for the training phase that would provide nicely evolving features.
So actually how do you model the time series ?? Using RBM ?? I think RBM was designed
for static picture recognition not dynamic time series. Or maybe you just feeding nets with static picture of the pattern ??? But in this case all info about dynamics of time series is lost.

Do you measure any error of recognition ?

Krzysztof
 

DionysusToast

Legendary member
5,963 1,498
Here is a question for philosophers and thread poets. Care to answer?

There is inherent structure in the images and speech that have been the targets of most DBN research... most children can do better than most machines because they have learned the structure. The machines try to extract the structure. Some do it well for images and speech. Can they do it for markets?

Is there structure to some representation of the markets? Certainly not recognizable by most adults. Probably not recognizable by majority of traders. Do supertraders recognize structure, or are they just defying the odds?

DBN machines make sense for robotic applications. Do they make sense for the market?
No.

Let's say you have a bad knee. You can see a number of different types of specialist and depending on the area of specialisation, you will either have a muscle problem, bone problem or even immune system problem. Therapy will be physio, drugs or operation.

What you won't get much of is "this is not within my area of specialisation". After all, if the only tool you have is a hammer...

And so it comes to trading. Take someone with a background in statistics and they will probably use statistical models. Take someone with a background in programming and they will be writing strategies based on existing specifications (i.e. trading books). Take someone with a background in Neural Nets.....

So - this is more of the same. Attempting to use knowledge gained outside of trading within trading. Trying to apply your own comfort zone where you are not comfortable.

Ultimately - if you want to make money trading, you have to learn how to trade yourself. If you can't do that, you have zero chance of getting a computer to learn for you.
 

Highfreq

Junior member
47 2
So actually how do you model the time series ?? Using RBM ?? I think RBM was designed
for static picture recognition not dynamic time series. Or maybe you just feeding nets with static picture of the pattern ??? But in this case all info about dynamics of time series is lost.

Do you measure any error of recognition ?

Krzysztof
That’s my point. The net is a classifier and to make it dynamic it is trained on new bars. I am not aware of an efficient online training algorithm that would do that. It currently works but it is not practical mostly because it is very slow to converge.
 

Highfreq

Junior member
47 2
No.

Let's say you have a bad knee. You can see a number of different types of specialist and depending on the area of specialisation, you will either have a muscle problem, bone problem or even immune system problem. Therapy will be physio, drugs or operation.

What you won't get much of is "this is not within my area of specialisation". After all, if the only tool you have is a hammer...

And so it comes to trading. Take someone with a background in statistics and they will probably use statistical models. Take someone with a background in programming and they will be writing strategies based on existing specifications (i.e. trading books). Take someone with a background in Neural Nets.....

So - this is more of the same. Attempting to use knowledge gained outside of trading within trading. Trying to apply your own comfort zone where you are not comfortable.

Ultimately - if you want to make money trading, you have to learn how to trade yourself. If you can't do that, you have zero chance of getting a computer to learn for you.
Totally agree. But convene that there are useful tools out there. Hypothetical Joe the trader was doing very poorly the other day. Markets were so fuzzy until he realized that he did not have his glasses on. He is not an optometrist himself but he now knows that wearing glasses can really help in his case.
 
  • Like
Reactions: DionysusToast

Krzysiaczek99

Well-known member
430 1
That’s my point. The net is a classifier and to make it dynamic it is trained on new bars. I am not aware of an efficient online training algorithm that would do that. It currently works but it is not practical mostly because it is very slow to converge.
Well, than perhaps you should read this Phd

"Composable, distributed-state models for high-dimensional time-series" from

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

Here is a video lecture where Hinton refers to this paper and describes how it works


Implementation of this Phd is one of the goals of this thread - see 1st post.

So do you measure accuracy of your current prediction or pattern recognition somehow ??

Krzysztof
 

Highfreq

Junior member
47 2
Well, than perhaps you should read this Phd

"Composable, distributed-state models for high-dimensional time-series" from

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

Here is a video lecture where Hinton refers to this paper and describes how it works


Implementation of this Phd is one of the goals of this thread - see 1st post.

So do you measure accuracy of your current prediction or pattern recognition somehow ??

Krzysztof

I have experimented with the dynamic models from Graham. They are shallow nets though. They are not deep structures (2 layer dynamic CRBMs at most). So I have added layers which is allowed in theory but did not get any useful structure from the latent variables.

Accuracy wise? It depends. Detecting cycle shifts for example is close to 100% at completion. Usually I don’t wait full completion. 60% completion gives me about 70% accuracy. The shift of cycles to a larger time-frame appears to not be ambiguous in most cases and it seems to not depend on the instrument either. But choosing the patterns randomly leads to accuracies no better than chance. A lot of care is required in selecting the data to train the net on. It’s a general rule about nets when applied to markets I think. The naïve approach to feeding them with streaming market during training data does seem to work. I guess this is because there is no clear manifold to rely on.
 

Krzysiaczek99

Well-known member
430 1
I have experimented with the dynamic models from Graham. They are shallow nets though. They are not deep structures (2 layer dynamic CRBMs at most). So I have added layers which is allowed in theory but did not get any useful structure from the latent variables.

Accuracy wise? It depends. Detecting cycle shifts for example is close to 100% at completion. Usually I don’t wait full completion. 60% completion gives me about 70% accuracy. The shift of cycles to a larger time-frame appears to not be ambiguous in most cases and it seems to not depend on the instrument either. But choosing the patterns randomly leads to accuracies no better than chance. A lot of care is required in selecting the data to train the net on. It’s a general rule about nets when applied to markets I think. The naïve approach to feeding them with streaming market during training data does seem to work. I guess this is because there is no clear manifold to rely on.
Did you try FCRBM also ?? Any better luck ??

A lot of care is required in selecting the data to train the net on. It’s a general rule about nets when applied to markets I think.
How to select the proper data for training ?? By knowing this we know which patterns will
occur in the future we are immediately the winner i think.

How do you convert output from you cycle indicator to binary values or probalilities
as it is required by RBM ?? maybe there is a possibility to improve.

Krzysztof