Commit 6902a80
authored
spec: add bar-feature-importance specification (#2281)
## New Specification: `bar-feature-importance`
Related to #2276
---
### specification.md
# bar-feature-importance: Feature Importance Bar Chart
## Description
A horizontal bar chart displaying feature importances from machine
learning models, with features sorted by importance value and bars
colored by a gradient to emphasize relative contribution. This
visualization is essential for model interpretability, helping data
scientists and stakeholders understand which features drive model
predictions. The horizontal orientation allows for readable feature
names of varying lengths.
## Applications
- Explaining random forest or gradient boosting model decisions to
stakeholders
- Feature selection by identifying low-importance variables for removal
- Model debugging by detecting unexpected high-importance features that
may indicate data leakage
## Data
- `feature` (categorical) - Names of the model features displayed on the
y-axis
- `importance` (numeric) - Importance scores from the model, used for
bar length
- `std` (numeric, optional) - Standard deviation of importance for
ensemble methods, displayed as error bars
- Size: 10-30 features recommended for readability
- Example: Feature importances from sklearn RandomForestClassifier or
XGBoost
## Notes
- Sort bars by importance value (highest at top) for easy identification
of key features
- Use a sequential color gradient (e.g., light to dark) mapped to
importance values
- Error bars are optional but valuable for ensemble methods showing
importance variability
- Consider showing only top N features if the model has many features
- Include importance values as text annotations at the end of bars for
precision
---
**Next:** Add `approved` label to the issue to merge this PR.
---
:robot: *[spec-create
workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/20526511919)*
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>1 parent 9d12dc9 commit 6902a80
2 files changed
Lines changed: 57 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
0 commit comments