Commit d9cd2aa
fix: symmetrize covariance matrices before Cholesky decomposition
Added covariance symmetrization in GMM estimation for numerical stability.
This ensures exact symmetry before Cholesky decomposition, preventing
potential numerical issues from floating-point rounding errors.
Changes:
- In _estimate_gaussian_covariances_full(): symmetrize with (cov + cov.T) * 0.5
- In _estimate_gaussian_covariances_tied(): symmetrize with (cov + cov.T) * 0.5
- Applied before regularization to ensure exact symmetry
Benefits:
- Guarantees numerically exact symmetry (error = 0.00e+00)
- Prevents rare Cholesky decomposition failures
- Best practice for numerical hygiene in covariance estimation
Validation:
- Tested with synthetic data: all covariances perfectly symmetric
- Cholesky decomposition works correctly for all components
- No changes to convergence or model quality
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 6367144 commit d9cd2aa
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| |||
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
| 111 | + | |
| 112 | + | |
109 | 113 | | |
110 | 114 | | |
111 | 115 | | |
| |||
0 commit comments