Repository navigation
Conversation
Fix the two decolletage cells that fail under NumPy 2 (TypeError: only 0-dimensional arrays can be converted to Python scalars), which passed length-1 arrays to matplotlib as text and marker coordinates. Revise the lecture: - Redesign the simulated example (one-factor market, monthly Sharpe ratio 0.12, T = 120, true means close to the market-implied ones), so that extreme estimated portfolios come from estimation error rather than from the true parameters. The old example's true optimum was itself extreme, so shrinking toward the market made things worse. - Add sections on views about a few assets (He-Litterman P, Q, Omega), on whether shrinkage pays (Monte Carlo certainty-equivalent losses), and on robustness about the mean, including its Bayesian reading as shrinkage toward zero along an information contract curve. - Refactor the decolletage figures into one function with distinct colors and a legend; show Black-Litterman mixtures for three taus. - Appendix: define B as a ratio of limits, normalize the relative-MSE figure by its IID value, use "sampling interval" consistently, and move Merton's fixed-span experiment into the text. - Update Exercises 1-3, add figure captions, and fix wording, notation and citation style. - Add bib entries HeLitterman1999, GarlappiUppalWang2007, and DeMiguelGarlappiUppal2009. Co-Authored-By: Claude Opus 5.5 <[email protected]>
✅ Deploy Preview for lustrous-melomakarona-3ee73e ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟡 Changes recommended
A moderate active issue remains because the Black-Litterman lecture uses an explicit matrix inverse (np.linalg.inv) at line 389, which can be numerically unstable compared to solving a linear system for ill-conditioned covariance matrices.
1 open issue
What changed in this PR
This pull request updates the Black–Litterman lecture to (1) fix “curve decolletage” plotting cells that break under NumPy 2 / Matplotlib scalar-conversion rules and (2) substantially revise and extend the lecture’s narrative, simulations, figures, exercises, and references to better motivate estimation error, shrinkage, views, and robustness interpretations.
Changes:
- Fix and refactor the decolletage plotting code (single reusable function, clearer styling/legend) to avoid NumPy 2 failures caused by passing length-1 arrays where scalars are required.
- Redesign the main simulated market example and expand the lecture with new sections on few-asset views via (P,Q,\Omega), whether shrinkage pays (Monte Carlo certainty-equivalent losses), and robustness/Bayesian interpretations.
- Refresh appendix/exercises, improve captions/wording/notation consistency, and add new bibliography entries (He–Litterman 1999; Garlappi–Uppal–Wang 2007; DeMiguel–Garlappi–Uppal 2009).
Key review notes to address before approval (from inline comments):
- Avoid explicit matrix inverses (
np.linalg.inv) in multiple places; prefer linear solves for numerical stability (especially with ill-conditioned sample covariance matrices). quad_formcurrently recomputes an inverse per call; compute quadratic forms vianp.linalg.solveand support both scalar points and grid arrays without explicit inversion.- Clarify the
N_app - 1off-by-one workaround by slicing the generator output, rather than coupling loop logic to the generator’s internal sizing.
| File | Summary |
|---|---|
lectures/black_litterman.md |
Major lecture rewrite (new simulated example; added sections on views, shrinkage payoffs, robustness/Bayesian reading; updated exercises/appendix) and refactored decolletage plotting to work under NumPy 2. |
lectures/_static/quant-econ.bib |
Adds BibTeX entries required by the revised lecture’s new citations (He–Litterman 1999; Garlappi–Uppal–Wang 2007; DeMiguel–Garlappi–Uppal 2009). |
Review effort: Balanced

Fix the two decolletage cells that fail under NumPy 2 (TypeError: only 0-dimensional arrays can be converted to Python scalars), which passed length-1 arrays to matplotlib as text and marker coordinates.
Revise the lecture: