Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Learn from the Experts Ep 4: Avoiding Overfitting via Cross-Validation with Joakim

In this video, Quantopian community member and challenge winner, Joakim Arvidsson, walks through his algorithm creation process with Quantopian’s Thomas Wiecki. This video starts with a short interview about Joakim’s background in investment banking and continues with Joakim walking through an example algorithm he created on Quantopian.

As a long time community member and winner of the daily contest and multiple challenges, Joakim shows how he puts his skills to use on the Quantopian platform. He also explains the reasoning behind his decisions, allowing you to walk away with a better understanding of how financial algorithms work and a starting point for creating your own.

Submit to our latest challenge here to test your skills and for a chance to win cash prizes.

You can watch it at this link, or below:

Learn more by subscribing to our YouTube channel to access all of our videos and be notified when a new one is posted.

As always, if there are any topics you would like us to focus on for future videos, please comment below or send us a quick note at [email protected].

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

8 responses

Thanks for your generosity! A great video!

Thanks @Emiliano!

@All, here's the research notebook used in the video. As mentioned, it is based off of Thomas' original notebook: "Tackling overfitting via cross-validation over quarters."

And here's the backtest, including the 2 years of out-of-sample testing from Jan 2017 - Jan 2019.

The Pyfolio tearsheet with in-sample and out-of-sample analysis.

And the new (alpha-decay) tearsheet.

Hi
You mention tstats(IC) as something you look at in the alphalens.
could you please elaborate more on what this info can add?

Thanks!

Hi Idan,

I use it to determine if the factor is statistically significant or not. Both in training and when cross validating. I find it easier to use, instead of p-values lower than a certain threshold, for deciding when to reject the null hypothesis (and instead accept the alternative hypothesis). Especially for really robust factors (and factor combinations). This page explains it pretty well in my opinion.

Hi Joakim,

Thanks for sharing your process. Started two weeks ago and your notebook is really helpful to get a quick start!

When going through your process and testing two easy factors (3month return and 1year return) I do however face some problems on how to iterate through the cells. In the attached notebook I'm building the alphalens forward returns for the simple 3month share price return and 1 year share price return factors, then when trying to tweak the factors by taking the risk-adjusted share price return for the two periods I do get quite a few infinite values. Am I making a mistake when iterating through the cells after re-running the changed factors?

Thanks for your help!