statistical-visualizations
Build and troubleshoot ManimML statistical, probability, decision-tree, MCMC, Gaussian, and matplotlib-image visualizations with safe CPU-first recipes.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- statistical-visualizations
- license
- MIT
- metadata
- { "package": "manim_ml", "disco-role": "operating", "sub-skill-role": "statistical-probability-visualization" }
- description
- Build and troubleshoot ManimML statistical, probability, decision-tree, MCMC, Gaussian, and matplotlib-image visualizations with safe CPU-first recipes.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md8.7 KB
- 参考文档references/troubleshooting.md6.4 KB
- 参考文档references/workflows.md9.1 KB
- 脚本scripts/build_statistical_visualizations.py13.9 KB
03 SKILL.md 正文
Statistical visualizations with ManimML
Use this sub-skill when a task asks for ManimML scenes or helper code involving statistical or probability visualizations:
- scikit-learn decision-tree diagrams from a fitted
DecisionTreeClassifier.tree_. - Iris-style two-feature scatter plots and decision-surface overlays.
- Metropolis-Hastings sampling checks, MCMC axes, and compact chain animations.
- 2-D Gaussian/probability mobjects.
- Converting matplotlib/seaborn figures into Manim
ImageMobjectobjects.
Route neural-network layer diagrams, forward-pass animations, dropout, and CNN/image-layer workflows to the neural-network-visualization sub-skill instead.
Required runtime assumptions
The target Python environment should import Manim Community, ManimML, NumPy, Pillow, SciPy, matplotlib, seaborn, scikit-learn, and tqdm. These workflows are CPU workflows. Full video rendering is optional and may additionally require the usual Manim system rendering stack.
For headless execution, set matplotlib to the Agg backend before creating figures:
import matplotlib
matplotlib.use("Agg", force=True)
First checks
Run the bundled helper from this sub-skill directory to verify package-level construction without rendering:
python scripts/build_statistical_visualizations.py --help
python scripts/build_statistical_visualizations.py --example sampler --iterations 12
python scripts/build_statistical_visualizations.py --example decision-tree --max-depth 2
--example all runs the compact sampler, decision-tree, MCMC axes, Gaussian, and matplotlib-image construction checks. These checks synthesize their own tiny data or icons and do not require repository example assets.
Capability map
| Need | Use | Details |
|---|---|---|
| Fitted scikit-learn tree diagram | DecisionTreeDiagram(sklearn_tree, feature_names=..., class_images_paths=...) |
Leaves require image paths in the current implementation. Use generated temporary icons or caller-provided class images. |
| Decision areas over a 2-D feature plane | compute_decision_areas(tree_classifier, maxrange, x=0, y=1, n_features=2) |
Compute rectangles first; only build a Manim surface after confirming finite ranges and compatible axes. |
| Iris-style dataset scatter | IrisDatasetPlot(iris) |
Designed for sklearn's iris object and the first two features. Treat full rendering as optional. |
| Metropolis-Hastings sampler | metropolis_hastings_sampler(...) |
Required smoke path. Returns samples, an empty warm-up array, and proposals. |
| MCMC axes/animations | MCMCAxes(...) |
Construct axes and proposal/chain animations with tiny iteration counts before rendering. |
| Gaussian probability overlay | GaussianDistribution(axes, mean=..., cov=..., dist_theme="gaussian") |
Use 2-D mean/covariance matching the axes. |
| Matplotlib figure as Manim image | convert_matplotlib_figure_to_image_mobject(fig, dpi=...) |
Use Agg, close figures after conversion, and avoid remote datasets. |
Safe operating pattern
- Decide whether the output is only a static Manim object, an animation object, or a rendered video/still.
- Keep data tiny for construction checks: two iris features, shallow trees, 10-25 MCMC iterations, and small generated icons/images.
- Import
DecisionTreeSurfaceandIrisDatasetPlotfrommanim_ml.decision_tree.decision_tree_surface; do not rely on outdated re-export assumptions. - For decision-tree leaves, provide three valid image files when using the iris classifier. If no real images are available, generate simple colored square icons.
- For MCMC animation construction, provide
true_samplesif callingvisualize_metropolis_hastings_chain_sampling; it builds a background density image. - Render only after construction succeeds. Prefer Manim low quality (
-ql) or still-image (-s) flags for first renders.
Reference files
references/api-reference.md- public API signatures, return expectations, and source limitations.references/workflows.md- self-contained decision-tree, MCMC, Gaussian, and matplotlib recipes.references/troubleshooting.md- common errors and recovery steps.scripts/build_statistical_visualizations.py- CPU-first smoke helper with no default render step.
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).