Machine learning in trading: theory, models, practice and algo-trading - page 1205

 
Aleksey Nikolayev:

Why prices and not their increments?

I don't know what's better... and the sample length can be varied... a lot of fuss with all this

I added about interpretability... like, what's there to interpret? There's only one metric
 
FxTrader562:

Hi maxim

Is there any new article which you are discussing here?

If you can provide me the link?

Hi, not yet published, waiting for moderation

 
FxTrader562:

Ok, if you want , then you can provide me the code so that I can have a look at it.

better if you just wait for article, because I have too many versions

 
mytarmailS:

And the dependence, in fact, is there...

I trained "SMM" (hidden Markov model) on returnees, divided it into 10 states and taught it without a teacher, so it itself divided different distributions


state distributions.


And here I grouped returns by states, i.e. each row is a separate market state

In some states (1,4,6,8,9) there are too few observations, so you can not take them at all

And now I will try to restore the series, that is to make a cumulative sum, if some tendency is found in some of the states - the regularity in the direction

I did a cumulative summation.

States 5 and 7 have a stable structure, 5 for the bay and 7 for the village.

you finally started to go in the right direction :)

all you have to do is bruteforce the whole thing with elementary brute force and choose the best model

With logical deduction and the great method of deduction a profitable scheme can never be picked up, there are too many variations
 
Maxim Dmitrievsky:

You're finally starting to go in the right direction :)

All you have to do is bruteforce all of this stuff with a simple brute force search and choose the best model

You can never pick up a profitable scheme by logical deduction, there are too many variants

But here's the funny thing, these states 5 and 7 change most often, they are not continuous in time and another thing is that they are among themselves and switch))


the graph of state transitions


And this is what it looks like when you trade them. Red sell and blue buy


 
Maxim Dmitrievsky:

Now I want to add to the optimized parameters the dependence of signals on distributions, I did it for the beginning, to see

If the kurtosis is higher than a certain value (you can opt for it), then we have a flat situation and it is possible to buy/sell with the same probability (and then to fix all the wrong ones)

further on asymmetry, if there is a certain side, then the probability of the signal to buy or to sell is displaced

This is a primitive one, but this is the way we can select the targets in the optimizer

All you need to get from metrics is classification error on a test sample (to be trained on a training sample). The optimizer goes through the hyperparameters and chooses the model with the lowest error. What is non-interpretable here? It is enough to know, looking at the errors on the test data, whether such a model is capable of generalizing or not.

I just made an example of working with such a clunker.


The question is in the interpretability of eventually selected model (which will actually trade).

 
mytarmailS:

But here's the funny thing, these states 5 and 7 change most frequently, they are not continuous in time, and another thing is that they switch among themselves))


the graph of state transitions


And this is what it looks like when you trade them. Red is down and blue is up


Do it with RL, you should approximate the Markov model

 
Aleksey Nikolayev:

The question is in the interpretability of the eventually chosen model (which will actually trade).

Inductive models are not interpretable, as a rule, both genetic programming and neural networks... it takes a long time to take back to pieces

Python and R probably have corresponding packages

example for trees
How to visualize decision tree
How to visualize decision tree
  • explained.ai
Decision trees are the fundamental building block of gradient boosting machines and Random Forests(tm), probably the two most popular machine learning models for structured data. Visualizing decision trees is a tremendous aid when learning how these models work and when interpreting models. Unfortunately, current visualization packages are rudimentary and not immediately helpful to the novice. For example, we couldn't find a library that visualizes how decision nodes split up the feature space. So, we've created a general package (part of the animl library) for scikit-learn decision tree visualization and model interpretation.
 
Maxim Dmitrievsky:

Well, do it all through RL, the Markov model must be approximated by something.

And why should it be approximated? It's already divided into 10 states by the Viterbi algorithm, as a cluster in essence

I think that the price should be approximated before doing returns or not to do returns?

 

By the way, if anyone wants to dabble with "cmm" here is an article with code and examples in R

http://gekkoquant.com/2014/09/07/hidden-markov-models-examples-in-r-part-3-of-4/

Hidden Markov Models – Examples In R – Part 3 of 4
Hidden Markov Models – Examples In R – Part 3 of 4
  • 2014.09.07
  • GekkoQuant
  • gekkoquant.com
This post will explore how to train hidden markov models in R. The previous posts in this series detailed the maths that power the HMM, fortunately all of this has been implemented for us in the RHmm package. HMMs can be used in two ways for regime detection, the first is to use a single HMM where each state in the HMM is considered a “regime”...