Skip to content

Show feature importance for tree-based models #6

Description

@jeanclawd

Problem

Every tree-based model in scikit-learn exposes `feature_importances_`, which is one of the most useful diagnostics a data scientist looks at after training. Scikit-Learner trains all of these models but never surfaces the information.

Proposal

When the user trains any tree-based model (Decision Tree, Extra Tree, Random Forest, Gradient Boosting, HistGradientBoosting, AdaBoost, Bagging — plus XGBoost / LightGBM once #3 lands), render a horizontal Plotly bar chart of feature importances sorted descending.

Implementation notes

  • In `frontend/py/learner.py`, in the result dict returned by `train()`, add a `feature_importances` field whenever `hasattr(model, 'feature_importances_')`. Map back to the original feature names.
  • In `frontend/js/app.js`, add a "Feature Importance" tab (or sub-section in the existing model detail view) that renders the chart when the field is present.
  • Skip silently for non-tree models — no error UI needed.

Acceptance criteria

  • Tree-based models show a feature-importance chart immediately after training.
  • Bars are sorted descending, labelled with the original column names.
  • Non-tree models show no chart and no error.

Why now

3-line addition per model in Python, ~30 lines of JS for the chart. Very high payoff for the effort — users see this and immediately get why "the model thinks this".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions