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

 
Aleksey Nikolayev #:

I don't know much about either python or catbusta, but I'll ask stupid questions)

1) What is data, why is the average not from preds?

2) It seems that for gradient bousting you need to specify formulas for gradient and hessian?

Apparently yes, I missed something. I used the template from the official site https://catboost.ai/en/docs/concepts/python-usages-examples.

data - generated list of model predictions, I converted negative values into positive ones to calculate their arithmetic mean for Sharpe's average

 
Evgeni Gavrilovi #:

data - generated list of model predictions, negative values were converted to positive values to calculate their arithmetic mean for Sharpe's average

Why? For Sharpe, the average with the original signs is calculated.

 
Aleksey Nikolayev #:

Why? For Sharpe, the average with the original signs is considered.

To take into account also sell orders, let's say there are 2 accurate forecasts -0.002 (20 pips) and +0.003 (minus - short, plus - long).

Profit is +0.005, average is 0.0025, and without changing the sign it will be 0.0005.


It turns out that a custom metric requires its own loss function, by analogy classRmseObjective(object )
 
Evgeni Gavrilovi #:

Apparently yes, missed something. I used the template from the official site https://catboost.ai/en/docs/concepts/python-usages-examples.

There are two types of metrics loss_function and eval_metric. You probably need the first one, look here https://catboost.ai/en/docs/concepts/python-usages-examples#user-defined-loss-function

But I may be wrong. There are better python experts and python praisers here than me) Maybe they will help you more.

 
Evgeni Gavrilovi #:

To take into account also sell orders, let's say there are 2 accurate forecasts -0.002 (20 pips) and +0.003 (minus - short, plus - long).

Profit +0.005, the average is 0.0025, and without changing the sign it will be 0.0005.

Well, that wouldn't be a Sharpe. Also, perhaps, it is necessary not just to take the module, but to multiply it by the sign of the forecast (by minus one if selling and by one if buying).

 
Evgeni Gavrilovi catboost, need Sharp.

The result of training a model with my version is almost the same as with RMSE, so there is an error somewhere in the code.

preds and target are return (a[i]-a[i+1])

Print the values you get and compare them with the other metric. Print both at once, for each iteration. In catbust early stop don't forget to include the maximum of custom criterion and "use best model=True" You can just turn on Verbose, it will print metrics values at each iteration by itself.
 
Maxim Dmitrievsky #:
Print the values you get and compare them with the other metric. Print both at once, for each iteration. In catbusta early stop don't forget to enable max user criteria and "use best model=True" You can just enable Verbose, it will print metric values at each iteration.

It would be interesting for research purposes (even though it is quite complicated) to do via a custom loss function. There is a possibility for this (if you are thrown to the beginning of the page, you need to find the User-defined loss function section at the very bottom).

Usage examples
Usage examples
  • catboost.ai
Regression CatBoostRegressor class with array-like data.
 
Aleksey Nikolayev #:

It would be interesting for research purposes (although it is quite complicated) to make a custom loss function. There is a possibility for this (if you are thrown to the beginning of the page, you should find the User-defined loss function section at the very bottom).

Let's try it later
 
Aleksey Nikolayev #:

It would be interesting for research purposes (although it is quite complicated) to make a custom loss function. There is a possibility for this (if you are thrown to the beginning of the page, you need to find the User-defined loss function section at the very bottom).

It didn't work for me with xgboost....
Or rather it worked, but the training didn't work, you need to make good friends with gradients there, you need to make the fitness function gradient, with genetics it's much simpler
 
mytarmailS #:
I didn't succeed with xgboost...
Or rather, I did, but the training did not work, you need to make good friends with gradients there, you need to make the fitness function gradient, with genetics is much easier

Yeah, that's the tricky part. You have to calculate the gradient and the matrix of second derivatives, the Hessian. The Hessian must also be positively definite.

For profit, for example, the Hessian is degenerate like (equal to zero). It is necessary to somehow finesse the loss function to a reasonable compromise between need and necessity.

Reason: