robertmartin8 / PyPortfolioOpt

Financial portfolio optimisation in python, including classical efficient frontier, Black-Litterman, Hierarchical Risk Parity
https://pyportfolioopt.readthedocs.io/
MIT License
4.38k stars 940 forks source link

Feature request: Divisive Analysis Clustering #384

Open michaelmech opened 2 years ago

michaelmech commented 2 years ago

I skimmed through a paper titled "A constrained hierarchical risk parity algorithm with cluster-based capital allocation"(by Katzke and Pfitzinger), which compared variations of HRP with other portfolio optimization models. In short, their findings revealed that a divisive analysis clustering algorithm(DIANA) performed better in many areas(risk-adjusted return,turnover,volatility, etc.) than the default agglomerative hierarchical clustering of HRP(AGNES).

With that being said, I'd like to suggest the addition of a variation of the HRP optimizer that uses DIANA rather than AGNES to construct its linkage matrix. As far as I can tell, scipy's linkage function does not provide a way to implement DIANA, and I don't know of any python libraries that do. I was thinking of simply using K-means to recursively divide up into new clusters, but I'm still unsure how to represent its results in a linkage matrix.