Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi class Feature Importance #338

Open
PhilipNell opened this issue Oct 9, 2020 · 5 comments
Open

Multi class Feature Importance #338

PhilipNell opened this issue Oct 9, 2020 · 5 comments
Labels
feature 💡 New feature or enhancement request long term 📆 TODO long term Python 🐍 Related to Python

Comments

@PhilipNell
Copy link

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

@hbaniecki hbaniecki added the Python 🐍 Related to Python label Oct 9, 2020
@hbaniecki
Copy link
Member

hbaniecki commented Oct 9, 2020

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.

multiclass.zip

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.

@hbaniecki hbaniecki added the long term 📆 TODO long term label Oct 9, 2020
@PhilipNell
Copy link
Author

Awesome, thanks for the swift reply. Will have a look at it.

@hbaniecki hbaniecki added the feature 💡 New feature or enhancement request label Aug 11, 2021
@pbiecek
Copy link
Member

pbiecek commented Jan 15, 2022

@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

@hbaniecki
Copy link
Member

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.

@hbaniecki
Copy link
Member

hbaniecki commented Apr 17, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 💡 New feature or enhancement request long term 📆 TODO long term Python 🐍 Related to Python
Projects
None yet
Development

No branches or pull requests

3 participants