From the course: Practical Python for Algorithmic Trading
Unlock the full course today
Join today to access over 23,400 courses taught by industry experts.
Configure and run the backtest with the regression model - Python Tutorial
From the course: Practical Python for Algorithmic Trading
Configure and run the backtest with the regression model
- [Instructor] So far, we have developed an investment strategy with a machine learning model that classifies whether the stock will go up or down and we saw the returns of that algorithm. Now we will work with an investment strategy with regression models where we will predict the numerical increase of the stock for tomorrow. Now, let's explain the lines of code to develop this table. The first thing that we need to do is to load the regression model we saved previously. We can see the efficient tree regressor and the dataset. We import the backtesting library to define our investment strategy. We can copy paste the code we developed in the classification strategy. We paste it here. We'll call it regression. Now we need to adapt this code to a regression problem because our forecast from the prediction won't be up or down. It will be a numerical column. Therefore, instead of using equals to up, we can establish a…