-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add stochastic volatility to Bayesian tear sheet #174
Conversation
Posterior PDF for log(sigma) and log(nu). Also plots the stochastic volatility on top of the returns.
row += 1 | ||
ax_sigma_log = plt.subplot(gs[row, 0]) | ||
ax_nu_log = plt.subplot(gs[row, 1]) | ||
sigma_log = trace_stoch_vol['sigma_log'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the below to be a separate function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, might not be worth it.
Looks great, thanks. Can you remove |
Explain the 8th and 9th rows in the Bayesian ipython notebook demonstrating the tear sheet. Also, a few grammatical edits to the rest of the Bayesian notebook. Reset spy.csv
Add a line to gitignore so that new notebook checkpoints are ignored.
Time to complete each model and plot is printed as each task is completed.
Stochastic volatility model takes as much time to run as rest of models combined, so turn it off by default.
If you are happy with these changes, I'm ready to close this pull request. I'm going to start working on understanding the runtime of the stochastic volatility model as a function of the size of the returns dataset. |
Looks great! One last thing: I think we should add the truncation to the last 400 days and display a warning that we're truncating if the data passed in is more than 400 days. |
I just implemented this change on my local working copy. However, I only noticed a minor performance improvement. Using 400 days of returns (instead of the full set of 858 days), running the stochastic volatility model requires 88 seconds instead of ~110 seconds. This is on a Macbook Air from late 2013. How much testing have you done as far as number of days of returns and time required to run the stochastic volatility model? |
Not much, but I have seen it fail for a larger number. If it works just as well on 858 days maybe this is fine. It's not rare though to pass in a 10 year backtest which would be ~2520 days and I would expect the model to fail in that case. Worth a try though. |
Use only the most recent 400 days of returns.
I'm going to open a new branch to explore time required to run model_stoch_vol as a function of number of returns and to work on caching. |
I wasn’t quite finished running the Bayesian IPython notebook when I last pushed, apparently.
Do you mean something other than "cutoff"? |
No, something other than replacing |
df_train is unchanged if the user wants to run the stochastic volatility model.
Thanks! Can you rebase this off of master and we can merge. |
I don't have experience with rebasing in git. From looking at the git book, I'm thinking I need to do something like git rebase pyfolio/master. But I'm not sure, and it seems that this is an area that can cause trouble if done poorly. So I'd rather make sure I get it right the first time. Let me know if this sounds right to you. |
Rebased and merged via 15663a6. Thanks! |
Adds the following three plots to Bayesian tear sheet: