sogeking30/CLUSTERING-MARKET-REGIMES
๐ Detect market regimes by clustering probability distributions using Wasserstein K-means for more accurate financial analysis and insights.
What's novel
๐ Detect market regimes by clustering probability distributions using Wasserstein K-means for more accurate financial analysis and insights.
Code Analysis
9 files read ยท 3 roundsImplements the Wasserstein k-means clustering algorithm from Horvath et al. (2021) to detect bull/bear market regimes in financial time series, with synthetic data generators (GBM, Merton Jump Diffusion), MMD-based validation metrics, and extensive visualization.
Strengths
The core algorithm is a genuine, mathematically correct implementation of 1D Wasserstein k-means with proper barycenter computation, MMD validation, and both real-data (SPY) and synthetic experiment pipelines that faithfully reproduce the paper's methodology. Code is well-documented with references to specific equations and definitions from the source paper.
Weaknesses
Zero test coverage, the README contains nonsensical installation instructions (pip install a .zip, python a .zip URL), and there are performance issues (O(nยฒ) loops in accuracy scoring and distance computation) that would make it impractical for large datasets. The package.json with a 'claude' dependency is irrelevant noise, and requirements.txt lists unused packages (POT, hmmlearn).
Score Breakdown
Signal breakdown
Innovation
Craft
Traction
Scope
Evidence
Commits
8
Contributors
2
Files
51
Active weeks
3
Repository
Language
Python
Stars
1
Forks
0
License
โ