Home

Awesome

Permutation based feature importance

This code estimate the importances of the features of a fastai tabular learner model using the permutation method.

While I made some modifications to it (adding functionalities and fixing bugs) most of the credits goes to Miguel Mota Pinto for the first prototype, Zachary Mueller for the improved version and John Keefe for the plotting function.

Usage

from feature_importance import *

# gets feature importances as a dataframe
importances = feature_importance(learn)

# note that you can, optionnally, specify the dataset on which you want to compute the importances (validation dataset by default)
importances_train = feature_importance(learn, DatasetType.Train)

# plots feature importances directly
plot_feature_importance(learn)

Todo

For more unofficial fastai extensions, see the Fastai Extensions Repository.