Probabilistic-programming-and-bayesian-methods-for-hackers: Chapter 6: Mean-Variance Optimisation Loss Function

Created on 18 Sep 2015  ·  8Comments  ·  Source: CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers

Hi Cam,

Could you explain how to use (or reference to a source) this loss function:

screenshot from 2015-09-18 12 24 13

I'm assuming that the loss function is attempting to minimise the portfolio weights for the 4 stocks (which can be done using scipy optimise etc.), but I'm not sure what the lambda parameter is.

Thanks!

Most helpful comment

OK, fix done:

https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/pull/347 for two notebooks.

For the record, another good reference, by William Sharpe:
https://web.stanford.edu/~wfsharpe/mia/opt/mia_opt3.htm --
and I'll be doing a tutorial at https://git.io/fecon235
in regards to Boltzmann portfolios.

All 8 comments

@Anjum48 which chapter is this?
@CamDavidsonPilon lambda seems like the regularization parameter?

loss function is attempting to minimise the portfolio weights for the 4 stocks

This is trivially solved by setting them all to negative infinity, so I don't think you meant to say that. It's two counteracting forces: the larger the weights, the larger the first term (return), but also the larger the variance (second term).

The lambda parameter is a user specified parameter that is a tradeoff between maximizing the return (the first term) and the second term (the portfolio variance). It's not a regularizer in the traditional regression sense but it is analogous.

This is a pretty common formula in finance - it's the lagrangian of a quadratic problem: http://www.actuaries.org/AFIR/Colloquia/Rome2/Cesarone_Scozzari_Tardella.pdf

@CamDavidsonPilon
I don't understand that the optimizer use min, I mean, you should want to maximize your return and
be penalized by variance. So you should use max or append a negative sign instead of using min.

The lambda 𝛌 is often referred to (e.g. here) as the "risk aversion" parameter -- the tradeoff @CamDavidsonPilon mentions.

If lambda 𝛌 = 1, then the objective function approximates the portfolio's
geometric mean return, and that's something one should maximize
with respect to the weights (which by construction should sum to 1).

There definitely seems to be a minus sign missing.

Yea it should be max 👍

OK, fix done:

https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/pull/347 for two notebooks.

For the record, another good reference, by William Sharpe:
https://web.stanford.edu/~wfsharpe/mia/opt/mia_opt3.htm --
and I'll be doing a tutorial at https://git.io/fecon235
in regards to Boltzmann portfolios.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kjschiroo picture kjschiroo  ·  4Comments

cledoux picture cledoux  ·  13Comments

cledoux picture cledoux  ·  13Comments

eyaler picture eyaler  ·  12Comments

sheldonpark picture sheldonpark  ·  7Comments