DALEX
DALEX copied to clipboard
Multi class Feature Importance
Multi class feature importance is returning NaN for all variables. Does Dalex in Python support multi class? Jupyter NB and datafile is attached Archive.zip
Hi, Python dalex
doesn't support multiclass
overall.
For it to work (in Feature Importance) you have to pass a custom predict_function
to the Explainer
and a custom loss_function
to the model_parts
method. Moreover, the form of y
parameter should be taken into account in the loss_function
.
Now, the predict_function
doesn't return a (1d) np.array
so other methods may fail. Also, dx.Explainer
pointed out an error in residual_function
(should probably be custom as well).
Multiclass in this package is not a priority as all (or most) of the methods would need to be customised
EDIT: e.g. for predict_parts
it would be plotting one plot per class and for model/predict_profile
plotting one line per class. It can now be achieved by producing k
times Explainer
object, each predicting other class (custom predict_function
), and plotting them together.
In the long run, it is something we definitely want to add.
Awesome, thanks for the swift reply. Will have a look at it.
@hbaniecki would an additional argument like predict_function_target_column
be a help here?
then for multiclass object dalex can turn the classification into a binary classification model one-vs-all_others
Sure, I just don't like the parameter name of predidct_function_target_column
and am unsure about how to update all the yhat
functions to utilize that.
Example https://dalex.drwhy.ai/python-dalex-multioutput added in https://github.com/ModelOriented/DALEX-docs/commit/47378806fa9d32b612fb84adb46640638956ede7.