regularized-regression
Skill0 starsChanged 5 months agoMITView on GitHub
Fits Ridge, Lasso, or ElasticNet regression with cross-validated alpha selection. Produces a structured RegularizedRegressionReport (JSON + HTML) with a regularisation path, CV curve, feature selection summary, and OLS comparison.
In this repository5 other files it gives its agents.
- diagnosticsSkill
- linear-regressionSkill
- logistic-regressionSkill
- model-comparisonSkill
- pre-analysisSkill
The file
Files
regularized-regression
Fits Ridge, Lasso, or ElasticNet regression with cross-validated alpha selection. Produces a structured RegularizedRegressionReport (JSON + HTML) with a regularisation path, CV curve, feature selection summary, and OLS comparison.
When to use
- Your pre-analysis flags HIGH_VIF (multicollinearity) → try Ridge or ElasticNet.
- You have many features and expect a sparse signal → try Lasso.
- You want automatic feature selection with grouping of correlated predictors → use ElasticNet.
- Your OLS standard errors are unreliable due to collinearity → regularisation stabilises estimates.
Quick start
# Lasso (default) — auto-selects alpha via 5-fold CV
python .agents/skills/regularized-regression/scripts/fit.py \
--data data.csv \
--target price \
--features sqft,bedrooms,bathrooms,location \
--output out/lasso \
--dataset-name "Housing data"
# Ridge — good when all features plausibly contribute
python .agents/skills/regularized-regression/scripts/fit.py \
--data data.csv --target y --features all \
--method ridge --output out/ridge
# ElasticNet — multicollinear groups + sparse signal
python .agents/skills/regularized-regression/scripts/fit.py \
--data data.csv --target y --features all \
--method elasticnet --l1-ratio 0.7 --output out/enetArguments
| Flag | Default | Description |
--data | required | CSV or Parquet path |
--target | required | Numeric target column |
--features | required | Comma-separated columns, or all |
--method | lasso | ridge, lasso, or elasticnet |
--output | required | Output directory |
--log-target | off | Apply np.log to target before fitting |
--l1-ratio | 0.5 | ElasticNet mix (0 = Ridge, 1 = Lasso) |
--cv-folds | 5 | k-fold CV for alpha selection |
--alpha-rule | min | min (best CV) or 1se (parsimony) |
--dataset-name | "" | Label shown in HTML report header |
Outputs
out/
├── report.json # RegularizedRegressionReport (Pydantic schema)
└── report.html # Self-contained HTML with Plotly chartsReport sections
- Fit summary — R², adj. R², residual SE, selected α
- Coefficients — table + forest plot (non-zero features, sorted by |β|)
- Regularisation path — coefficient trajectories over the full α grid
- Cross-validation — CV R² curve with ±1 SD band and selected-α markers
- Interpretation — one plain-language fact per non-zero coefficient
- Feature selection (Lasso/ElasticNet only) — retained vs. zeroed features
- OLS comparison — side-by-side coefficient table and R² comparison
- Flags & recommendations
Notes
- Features are standardised before fitting; coefficients in the report are on the original scale.
- SE, CI, and p-values are approximate (derived from OLS). They are presented for orientation only — regularised estimators are biased, so classical frequentist inference does not strictly apply.
- Ridge never zeros coefficients;
feature_selectionisnullfor ridge.
References
references/regularization_choice.md— When to pick Ridge vs. Lasso vs. ElasticNetreferences/cv_strategies.md— How cross-validation and alpha selection rules work
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

