Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Test DecisionTreeClassifier Alpha and Calculate Sharpe Ratio

I am utilizing the DecistionTreeClassifier predict_proba() function to generate an Alpha Signal. Since the classifier is one of two values (0, 1), I hit the max_loss threshold immediately when generating the get_clean_factor_and_forward_returns() and later factor_returns() functions. Any ideas on how to avoid this and properly test my classifier prediction? The end goal is to calculate the Sharpe Ratio of the Alpha Signal factor returns.

Thanks.

3 responses

Hi Chris,
Predict should give you only 1 answer - in your case a 0 or 1... predict_proba will give you two probabilities (as you appear to be doing a binary classification from your description). The two values from predict_proba are the probability of a zero and the probability of a 1.
If you are using predict_proba and you only get back 0's and 1's then your data is perfectly seperable, which means the classifier is able to achieve 100% accuracy. As this probably isn't expected from your post description, I would look carefully at the data you are sending into the tree...
cheers,
Bruce

Bruce,

After taking some time to re-work several things, I am rounding back on this question but re-phrased instead. The following is hitting a 100% drop...get_clean_factor_and_forward_returns(factor=factor_data, prices=pricing_data, periods=[1]).

My factor_data is...0 or 1 for multiple years in a large stock universe. My pricing_data is simply pricing for the same multiple year timeframe plus 30 days.

Is the 100% drop due to the lack of different factor data values...every value is either 0 or 1?

Thank you,

Chris

Bruce,

I found a great post that gets to the bottom of this. Thanks for your help along the way.

https://www.quantopian.com/posts/how-can-i-use-alphalens-with-boolean-factor-true-and-false

Chris