Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
MAD Portfolio - Optimizer Problem

I was testing the notebook published under the forum topic: "MAD Portfolio an alternative to Markowitz?" I ran into an issue with the optimizer for various portfolio combinations. The portfolio would be divided evenly among all the securities. I have provided a basic example with just 2 securities. The NNLS optimizer believes that the result is successful. It allocates 50% of the portfolio to each of the 2 securities, SPY and BND.

I ran a brute force optimization to prove that this wasn't correct. I used the MAD results from the brute force optimizer to plot MAD vs. percentage of SPY. With only 2 securities, there are no local minima issues to trap the optimizer. Note the weights generated by the brute force optimization are far from the 50% allocation. Note also that the MAD at the 50% point reported by the NNLS optimizer matches the value on the MAD curve that I plotted.

I reallize that utilizing the brute force optimizer is NOT the solution to this issue. I merely used it as a tool to demonstrate the problem that I encountered with the default NNLS optimizer used by scipy.optimize in the notebook provided by James Christopher.

I haven't looked at any parameterization which might be avlailable for the NNLS optimizer or alternative optimizers yet. Perhaps the gradient isn't steep enough. I'll look to see what optimizer parameters might be adjustable.

Does anyone know what went wrong?

3 responses

Here is the original post about which I am commenting. I couldn't get it to link in my original post.

Rob Welsh
I believe I am correct in saying that making this change in your notebook ironed out the difference between the two scipy optimize algos?

I replaced the percent change with the difference of the log prices and ran the backtest.

There are definitely problems with the use of the Optimiser:
MAD Portfolio an alternative to Markowitz?