agentleFS
WindcleaverDevWindcleaverDev/regkit/.agents/skills/regularized-regression/SKILL.md

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.

The file

Files
SKILL.md

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/enet

Arguments

FlagDefaultDescription
--datarequiredCSV or Parquet path
--targetrequiredNumeric target column
--featuresrequiredComma-separated columns, or all
--methodlassoridge, lasso, or elasticnet
--outputrequiredOutput directory
--log-targetoffApply np.log to target before fitting
--l1-ratio0.5ElasticNet mix (0 = Ridge, 1 = Lasso)
--cv-folds5k-fold CV for alpha selection
--alpha-ruleminmin (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 charts

Report 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_selection is null for ridge.

References

  • references/regularization_choice.md — When to pick Ridge vs. Lasso vs. ElasticNet
  • references/cv_strategies.md — How cross-validation and alpha selection rules work

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.