Skip to content

Commit 6902a80

Browse files
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

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# bar-feature-importance: Feature Importance Bar Chart
2+
3+
## Description
4+
5+
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.
6+
7+
## Applications
8+
9+
- Explaining random forest or gradient boosting model decisions to stakeholders
10+
- Feature selection by identifying low-importance variables for removal
11+
- Model debugging by detecting unexpected high-importance features that may indicate data leakage
12+
13+
## Data
14+
15+
- `feature` (categorical) - Names of the model features displayed on the y-axis
16+
- `importance` (numeric) - Importance scores from the model, used for bar length
17+
- `std` (numeric, optional) - Standard deviation of importance for ensemble methods, displayed as error bars
18+
- Size: 10-30 features recommended for readability
19+
- Example: Feature importances from sklearn RandomForestClassifier or XGBoost
20+
21+
## Notes
22+
23+
- Sort bars by importance value (highest at top) for easy identification of key features
24+
- Use a sequential color gradient (e.g., light to dark) mapped to importance values
25+
- Error bars are optional but valuable for ensemble methods showing importance variability
26+
- Consider showing only top N features if the model has many features
27+
- Include importance values as text annotations at the end of bars for precision
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Specification-level metadata for bar-feature-importance
2+
# Auto-synced to PostgreSQL on push to main
3+
4+
spec_id: bar-feature-importance
5+
title: Feature Importance Bar Chart
6+
7+
# Specification tracking
8+
created: 2025-12-26T17:28:42Z
9+
updated: null
10+
issue: 2276
11+
suggested: MarkusNeusinger
12+
13+
# Classification tags (applies to all library implementations)
14+
# See docs/concepts/tagging-system.md for detailed guidelines
15+
tags:
16+
plot_type:
17+
- bar
18+
- horizontal
19+
data_type:
20+
- numeric
21+
- categorical
22+
domain:
23+
- general
24+
- statistics
25+
- technology
26+
features:
27+
- horizontal
28+
- sorted
29+
- color-mapped
30+
- ranking

0 commit comments

Comments
 (0)