Add make docs commands for html build

This commit is contained in:
Melvin Alvarez
2026-02-09 18:31:14 +01:00
parent 7a9ab20b89
commit 74fbbd369b
12 changed files with 255 additions and 65 deletions
+20 -5
View File
@@ -1,6 +1,6 @@
# Sparse Optimization
Sparse PCA and Elastic Net utilities with Rust speed.
Sparse PCA, Elastic Net, and BoxTao decomposition with Rust speed.
## Sparse PCA
@@ -13,6 +13,9 @@ components = sparse_pca_py(X, n_components=5, l1_ratio=0.15)
print(components.shape) # (5, 20)
```
- Output: component matrix `(n_components, n_features)`; rows are sparse loadings.
- Tuning: increase `l1_ratio` for harder sparsity; decrease to retain variance.
## Elastic Net
```python
@@ -25,7 +28,19 @@ coeffs = elastic_net_py(X, y, l1_ratio=0.3, alpha=0.01)
print(coeffs)
```
## Notes
- Inputs should be NumPy arrays; data is copied to Rust.
- `l1_ratio` balances sparsity vs ridge penalty.
- Standardize features before calling for stable solutions.
- Handles collinearity better than pure Lasso; use for factor shrinkage.
- Sweep `alpha` on a log scale (e.g., $10^{-3}$ to $10^{-1}$) and pick via validation.
## BoxTao decomposition
```python
from optimizr import box_tao_decomposition_py
solution = box_tao_decomposition_py(X)
```
Useful for constrained sparse decomposition problems; the Rust backend keeps iterations fast.
## Practical notes
- Inputs must be NumPy arrays; standardize features for stable conditioning.
- For high dimensional data, start with fewer components/features to avoid over-regularization.
- Combine with risk metrics: use sparse loadings to build interpretable factors, then evaluate with `compute_risk_metrics_py`.