regressor-visualizers
Use Yellowbrick regression diagnostics for residuals, prediction error, Cook's distance, alpha selection, and regression quick-method reports.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- regressor-visualizers
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use Yellowbrick regression diagnostics for residuals, prediction error, Cook's distance, alpha selection, and regression quick-method reports.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md7.8 KB
- 参考文档references/troubleshooting.md8.8 KB
- 参考文档references/workflows.md9.1 KB
- 脚本scripts/regression_smoke.py7.1 KB
03 SKILL.md 正文
Yellowbrick Regressor Visualizers
Use this sub-skill when the task is to diagnose or report scikit-learn regression models with Yellowbrick. It covers model score visualizers (ResidualsPlot, PredictionError), influence diagnostics (CooksDistance), regularization-alpha diagnostics (AlphaSelection, ManualAlphaSelection), and their quick methods.
For shared visualizer lifecycle, axes, style, and headless-rendering setup, load visualizer patterns. For installation, Matplotlib backend/font, and broad dependency troubleshooting, load the root troubleshooting reference. Route feature ranking and model-selection tasks such as FeatureImportances and RFECV to cluster/model-selection.
Fast routing
| User goal | Use | Why |
|---|---|---|
| "Are residuals random, centered, and normally distributed?" | ResidualsPlot |
Plots residuals (y_pred - y) against predicted values; optional histogram or Q-Q side panel helps evaluate linear-model assumptions. |
| "Are predictions systematically high/low across the target range?" | PredictionError |
Plots actual target y against predicted target ŷ; identity and best-fit lines expose bias, over/under-prediction, and variance. |
| "Which rows drive an OLS fit or look like influential outliers?" | CooksDistance |
Computes Cook's distance with an internal ordinary least-squares model and marks the 4/n influence threshold. |
| "Which alpha did a CV linear model choose?" | AlphaSelection |
Wraps RidgeCV, LassoCV, LassoLarsCV, or ElasticNetCV-style estimators and plots alpha versus stored CV error/score. |
"I have a non-CV estimator with an alpha parameter." |
ManualAlphaSelection |
Calls cross_val_score over an explicit alpha grid for estimators that support set_params(alpha=...). |
Minimal model-diagnostic workflow
import matplotlib
matplotlib.use("Agg") # use before importing pyplot in headless sessions
from sklearn.datasets import make_regression
from sklearn.linear_model import Ridge
from sklearn.model_selection import train_test_split
from yellowbrick.regressor import ResidualsPlot, PredictionError
X, y = make_regression(n_samples=250, n_features=8, noise=12.0, random_state=7)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=13)
residuals = ResidualsPlot(Ridge(alpha=1.0), hist="density")
residuals.fit(X_train, y_train)
residuals.score(X_test, y_test)
residuals.show(outpath="residuals.png", clear_figure=True, bbox_inches="tight")
pe = PredictionError(Ridge(alpha=1.0), shared_limits=True, bestfit=True, identity=True)
pe.fit(X_train, y_train)
pe.score(X_test, y_test)
pe.show(outpath="prediction_error.png", clear_figure=True, bbox_inches="tight")
Expected public attributes after scoring: ResidualsPlot.train_score_, ResidualsPlot.test_score_, and PredictionError.score_ contain the wrapped estimator's regression score, usually R^2.
Output/report rules
- Prefer class visualizers for reports because
show(outpath=..., clear_figure=True, bbox_inches="tight")saves and closes figures in a predictable way. - Quick methods are fine for notebooks or one-off plots. If you need a file, call the quick method with
show=False, then callviz.show(outpath=...)on the returned visualizer. - For residual diagnostics, score the training split first through
fit(X_train, y_train), then overlay test points withscore(X_test, y_test). Yellowbrick labels train and testR^2separately. - For
ResidualsPlot, choose eitherhistorqqplot;hist=Trueandqqplot=Truetogether raise aYellowbrickValueError. - For reusable automated reports, set a non-interactive Matplotlib backend (
Agg) before importingmatplotlib.pyplotor Yellowbrick visualizers.
Reference map
- API reference — concrete signatures, import paths, learned attributes, and quick-method caveats.
- Workflows — residual-vs-prediction-error selection, train/test overlays, alpha tuning, Cook's distance, and pipeline patterns.
- Troubleshooting — regressor type errors, fitted/refit decisions, Matplotlib issues, alpha-estimator compatibility, and report-output failures.
- Smoke helper — deterministic synthetic-data
Aggsmoke that writes regression diagnostic PNGs without network access.
Validate this sub-skill in a target environment
python skills/disco/yellowbrick/sub-skills/regressor-visualizers/scripts/regression_smoke.py --outdir /tmp/yellowbrick-regression-smoke
ls -1 /tmp/yellowbrick-regression-smoke
Expected output files include residuals_density.png, residuals_qq.png, prediction_error.png, cooks_distance.png, alpha_selection.png, manual_alpha_selection.png, and manifest.json.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).