Comments (8)
The next cell has
best_predictions= pd.read_hdf(results_path / 'predictions.h5', f'train/{lookahead:02}')
Just move this cell up so it runs before the one that threw the error. Will update the notebook accordingly.
from machine-learning-for-trading.
Hi Stefan,
Thanks for your reply. Maybe I was not very clear at very beginning. The key point is that in "predictions.h5" there is no 'train/01' at this time. There is only 'test/01'. According to the notebook, "We generate the train
predictions in the notebook alphalens_signal_quality
and the test
predictions in the notebook random_forest_return_signals
.", but it seems that I cannot find where 'train' predictions are made throughout 06_alphalens_signal_quality and 05_random_forest_return_signals.
Thanks again!
from machine-learning-for-trading.
Correct, should be test
or whichever way you choose to name the file containing your predictions unless you want to evaluate the training result. Updated accordingly.
from machine-learning-for-trading.
Then in 07_backtesting_with_zipline,
"
def load_predictions(bundle):
t = 1
df = pd.concat([pd.read_hdf(results_path / 'predictions.h5', 'train/{:02}'.format(t)),
pd.read_hdf(results_path / 'predictions.h5', 'test/{:02}'.format(t))])
df = df[~df.index.duplicated()].drop('y_test', axis=1)
....
"
we should remove the 'train/{:02}'.format(2) as well, right. Basically remove every 'train'?
from machine-learning-for-trading.
Not necessarily, you may want to compare in-sample vs out-of-sample performance. It depends on what you want to evaluate. In many cases, the train
predictions are the result of time-series cross-validation to select the best model, whereas test
refers to the out-of-sample predictions for the best model during a period following the cross-validation sample. You may want to evaluate the performance of both 'train' and test periods results.
from machine-learning-for-trading.
Yes I got the train and test separation part. Since there is no code to aggregate in-sample cross validation results to generate the 'train/01' predictions (only 'test/01' is explicitly generated), would you please add it? Thanks a lot!
from machine-learning-for-trading.
The train predictions are created during cross validation and stored in the last line of cell curently labeled 43
with pd.concat(predictions).to_hdf(cv_store, 'predictions/' + key)
.
You would select the version that corresponds to the best parameters you identify upon comparison. To 'explicitly' generate the file you are requesting, you would load those predictions and save under a the 'train' name of your choosing. I'm currently a bit busy but will see if I can add more comments to clarify.
from machine-learning-for-trading.
Thanks Stefan. No need for that. I can find myself. Thanks for your time and patience! Your book is very helpful!
from machine-learning-for-trading.
Related Issues (20)
- SARIMA notebook - huge amount of errors HOT 1
- MESSAGE_TYPES.XLS CHAPTER 2 HOT 2
- Chapter 2 notebook 1. Key error. HOT 7
- facing error while installing ta-lib HOT 2
- Facing issue while installing zipline for Windows HOT 1
- %load_ext zipline HOT 1
- problem in Long-Short Strategy, Part 1: Preparing Alpha Factors and Features HOT 1
- rsi HOT 1
- Daily historical return deciles HOT 1
- back testing is not working HOT 1
- Chapter 7 - Evaluating signals using alphalens HOT 1
- Chapter 8 02_backtesting_with_zipline HOT 1
- 01_parse_itch_order_flow_messages HOT 3
- Chapter 8 02_backtesting_with_zipline custom_loader not working HOT 1
- --
- installation get stuck / mamba env update -n ml4t -f installation/ml4t-base.yml
- No object named P in the file HOT 3
- Twitter data gone? Broken link in "data/twitter_sentiment.ipynb"
- Unable to replicate backtest performance | Chapter 8 02_backtesting_with_zipline HOT 1
- TypeError: download() got multiple values for argument 'start' when using pandas_datareader.data
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from machine-learning-for-trading.