Skip to content

Chapter 6: Mean-Variance Optimisation Loss Function #277

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

Closed
Anjum48 opened this issue Sep 18, 2015 · 8 comments
Closed

Chapter 6: Mean-Variance Optimisation Loss Function #277

Anjum48 opened this issue Sep 18, 2015 · 8 comments

Comments

@Anjum48
Copy link

Anjum48 commented Sep 18, 2015

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!

@pieteradejong
Copy link
Contributor

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

@CamDavidsonPilon
Copy link
Owner

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

@yiyuezhuo
Copy link

@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.

@mdengler
Copy link

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

@rsvp
Copy link
Contributor

rsvp commented Jun 14, 2017

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).

@mdengler
Copy link

There definitely seems to be a minus sign missing.

@CamDavidsonPilon
Copy link
Owner

Yea it should be max 👍

@rsvp
Copy link
Contributor

rsvp commented Jun 15, 2017

OK, fix done:

#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.

CamDavidsonPilon added a commit that referenced this issue Jun 15, 2017
Fix #277 Ch6 portfolio optimization equation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants