Asset allocation and Simplex Transformation on LD Points - #634
sou-cheng-choi wants to merge 424 commits into
Conversation
alegresor
left a comment
There was a problem hiding this comment.
quickly reviewed just parts in qmcpy/discrete_distribution/simplex/. Make sure to index like [...,i] instead of [:,i] to account for possible replications. Missing doctests in the QMCPy framework. Perhaps this should be a true measure SimplexUniform and implement these as transforms of LD points?
| A class implementing various transformations from the unit cube to a simplex. | ||
|
|
||
| The simplex Ts is defined as: | ||
| Ts = {(x1, ..., xs) ∈ Rs : 0 ≤ x1 ≤ x2 ≤ ... ≤ xs ≤ 1} |
| if points.ndim == 1: | ||
| points = points.reshape(1, -1) | ||
|
|
||
| mask = np.all(points[:, :-1] <= points[:, 1:], axis=1) |
There was a problem hiding this comment.
should be points[...,:-1] <= points[...,1:] in case there are replications
| if points.ndim == 1: | ||
| points = points.reshape(1, -1) | ||
|
|
||
| return np.sort(points, axis=1) |
There was a problem hiding this comment.
np.sort(points,axis=-1) in case of replications
| y[:, d - 1] = points[:, d - 1] ** (1.0 / d) | ||
| for i in range(d - 2, -1, -1): | ||
| y[:, i] = y[:, i + 1] * points[:, i] ** (1.0 / (i + 1)) |
There was a problem hiding this comment.
index like [...,i] to account for replications
e2af183 to
6133f9d
Compare
|
Please review the code changes I've made today. |
- derive normalized and Root weights from shared cube points - compare each LD method with its matching IID baseline - visualize IID and LD points before and after simplex mappings - clarify figure interpretation and conclusions
JiangruiKang
left a comment
There was a problem hiding this comment.
The SimplexTransform tests and doctests pass, but I cannot approve the portfolio results yet. The 10- and 40-asset backtests apply weights in the return columns’ order to stocks in a different ticker order. The notebook acknowledges these mismatches, but still executes and displays the affected backtests. Please align the assets, rerun the notebook, and update the plots and conclusions.
The portfolio README calls the input CSVs versioned, while this PR tracks only the data README and generates CSVs from live Yahoo Finance downloads. Please correct that claim and provide stable data provenance sufficient to reproduce the reported numerical comparisons.
Summary
root,mirror,origami, andshiftmethods toqmcpy.discrete_distribution.simplex.SimplexTransform, implementing the cube-to-simplex transformations of Pillards & Cools (2005) / Pillards (2006).demos/portfolio/portfolio_allocation_demo.ipynb: generalizes portfolio-weight generation from 4 sampler types to 8 -- IID/Lattice/Sobol/Halton, each also offered as a<sampler>_rootvariant.python -W ignore -m unittest test.test_dd_discrete_distribs.TestSimplexTransform -vAI Assistance
No substantive AI assistance was used for this PR.
AI assistance substantively affected this PR, and I describe that use below.
Independent verification performed.
Checklist