# Probabilistic Sharpe Ratio

**URL:** <https://forum.numer.ai/t/probabilistic-sharpe-ratio/446>\
**Category:** Data Science\
**Created:** [May 21, 2020, 5:25pm UTC](https://forum.numer.ai/t/probabilistic-sharpe-ratio/446 "2020-05-21T17:25:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![richai](https://yyz1.discourse-cdn.com/flex009/user_avatar/forum.numer.ai/richai/32/2493_2.png) [@richai](https://forum.numer.ai/u/richai)\
**Post date:** [May 21, 2020, 5:25pm UTC](https://forum.numer.ai/t/probabilistic-sharpe-ratio/446/1 "2020-05-21T17:25:30Z")

</div>

From @jrai in the forums, a nice description with code of probabilistic sharpe. Has anyone written a version of this for Numerai? Of course on Numerai, we don’t use returns but instead correlation with the target but perhaps this idea can be used as a way to choose models that generalize much better out of sample. I think things like skewness, kurtosis will matter for your distribution of era correlations for the same reasons.

[https://quantdare.com/probabilistic-sharpe-ratio/](https://quantdare.com/probabilistic-sharpe-ratio/)

---

<div class="post-metadata">

**Author:** ![richai](https://yyz1.discourse-cdn.com/flex009/user_avatar/forum.numer.ai/richai/32/2493_2.png) [@richai](https://forum.numer.ai/u/richai)\
**Post date:** [May 21, 2020, 5:32pm UTC](https://forum.numer.ai/t/probabilistic-sharpe-ratio/446/2 "2020-05-21T17:32:53Z")

</div>

Can anyone show with cross validation whether it’s better to optimize for probabilistic sharpe than smart sharpe from @mdo?

> [@Performance Stationarity](http://forum.numer.ai/t/performance-stationarity/151/2):
>
> Great post Richard, much appreciated! These issues have been on my mind recently as I’ve been playing around with fitting models to feature neutral targets. I’ve been testing out the Sortino ratio as an alternative to Sharpe for doing hyperparameter selection, because it makes sense to me to only penalize downside volatility/variance. Interestingly I’m finding that Sortino does favor different and narrower ranges of hyperparameters than Sharpe. def sortino\_ratio(x, target=.02): xt = x - tar…

---

<div class="post-metadata">

**Author:** ![jrai](https://yyz1.discourse-cdn.com/flex009/user_avatar/forum.numer.ai/jrai/32/3291_2.png) [@jrai](https://forum.numer.ai/u/jrai)\
**Post date:** [May 21, 2020, 7:00pm UTC](https://forum.numer.ai/t/probabilistic-sharpe-ratio/446/3 "2020-05-21T19:00:09Z")

</div>

here is some of the code (not by me):

- [https://github.com/rubenbriones/Probabilistic-Sharpe-Ratio/blob/master/src/sharpe\_ratio\_stats.py](https://github.com/rubenbriones/Probabilistic-Sharpe-Ratio/blob/master/src/sharpe_ratio_stats.py)
- [https://github.com/rubenbriones/Probabilistic-Sharpe-Ratio/blob/master/notebooks/Probabilistic%20Sharpe%20Ratio%20Example.ipynb](https://github.com/rubenbriones/Probabilistic-Sharpe-Ratio/blob/master/notebooks/Probabilistic%20Sharpe%20Ratio%20Example.ipynb)

May also be helpful in Numerai Quant

---

<div class="post-metadata">

**Author:** ![of\_s](https://yyz1.discourse-cdn.com/flex009/user_avatar/forum.numer.ai/of_s/32/2627_2.png) [@of\_s](https://forum.numer.ai/u/of_s)\
**Post date:** [May 22, 2020, 5:57pm UTC](https://forum.numer.ai/t/probabilistic-sharpe-ratio/446/4 "2020-05-22T17:57:17Z")

</div>

Better confidence intervals around a flawed metric is still a…flawed metric. What this adjustment is trying to get at is to maximize the upside variance / downside variance, which partial moments already do.

---

<div class="post-metadata">

**Author:** ![arbitrage](https://yyz1.discourse-cdn.com/flex009/user_avatar/forum.numer.ai/arbitrage/32/2538_2.png) [@arbitrage](https://forum.numer.ai/u/arbitrage)\
**Post date:** [July 1, 2020, 2:34pm UTC](https://forum.numer.ai/t/probabilistic-sharpe-ratio/446/5 "2020-07-01T14:34:12Z")

</div>

Adjusted Sharpe ratio was introduced by Pezier (2005) in:

Alexander, Carol and Sheedy, Elizabeth, eds. (2005) _The professional risk managers’ handbook: a comprehensive guide to current theory and best practices._ PRMIA Publications, New York & London. ISBN 9780976609704

Adjusted Sharpe Ratio adjusts for skewness and kurtosis by incorporating a penalty factor for negative skewness and excess kurtosis.

The formula is given in a different paper since i couldn’t access the book:

\*NOTE: Carol Alexander is a personal friend/mentor

 ![image](https://canada1.discourse-cdn.com/flex009/uploads/numerai/original/1X/5eab232227a53e3f87d607ceec741a1cf43eb1e7.jpeg)

I calculate the adjusted sharpe ratio which adjusts for Numerai’s trading costs as well:

```python
import numpy as np
import scipy
from scipy.stats import skew, kurtosis

def annual_sharpe(x):
    return ((np.mean(x) -0.010415154) /np.std(x)) * np.sqrt(12)

def adj_sharpe(x):
    return annual_sharpe(x) * (1 + ((skew(x) / 6) * annual_sharpe(x)) - ((kurtosis(x) - 3) / 24) * (annual_sharpe(x) ** 2))

```

You should pass validation scores to these functions since they are monthly; adjust to weekly compounding to use this on your live performance.
