oegedijk / explainerdashboard

Quickly build Explainable AI dashboards that show the inner workings of so-called "blackbox" machine learning models.
http://explainerdashboard.readthedocs.io
MIT License
2.32k stars 332 forks source link

Additional filters to select random transaction in what if tab #262

Open michaelromagne opened 1 year ago

michaelromagne commented 1 year ago

Hello, Thanks a lot for the awesome package !

I would like to be able to select a random transaction in the what if tab based on feature values. The current what if tab is very nice, with the ability to select labels and prediction score to isolate FP or FN in the case of binary classification. But I would like to be able to isolate for instance people from 70 to 80 years old in the case of a classification task with a feature "Age", in order to initialize my what if case.

Do you think it would be relevant to add this in the explainerdashboard library or should I customize my dashboard on my side ?

Thanks !

oegedijk commented 1 year ago

Hi michael, I can see the appeal of such a feature.

Would quickly get complicated though: you'd need a column selection dropdown, then either a range slider for numerical columns or a multiselect dropdown for categorical ones.

In order to implement this you would first add this possibility to the random_index methods (for both ClassifierExplainer and RegressionExplainer e.g. here: https://github.com/oegedijk/explainerdashboard/blob/b2d3f0767f9f23958b1a22eea12b2cc5662c921a/explainerdashboard/explainers.py#L1477

(these methods are already a bit ugly with nested if statements, and probably will only get worse this way :)

Then you'd need to add some dynamic layout to the index selection component e.g. here:

https://github.com/oegedijk/explainerdashboard/blob/b2d3f0767f9f23958b1a22eea12b2cc5662c921a/explainerdashboard/dashboard_components/classifier_components.py#L28

All of this could probably be done, but I myself do not have the bandwidth for it right now. Would happily accept a PR though!

michaelromagne commented 1 year ago

Hi, thanks for all the details, it is very useful. I will try to have the bandwith in the upcoming weeks/months for this PR