AIX360
AIX360 copied to clipboard
Does the contrastive algorithm support TensorFlow and PyTorch Model?
From the contrastive algorithm, I only can find the constructors for the base and Keras model. Will there be any support for TensorFlow or PyTorch Model? Thank you.
@Tomcli yes .. we would like to make all explainability algorithms framework independent. So that we could obtain contrastive explanations for models trained using other frameworks - tensorflow, pytorch, mxnet, etc.
For this, ideally we would like to build a few framework-specific base classes (similar to KerasClassifier for keras) that expose a common set of APIs which could be invoked from within the explainability algorithms. This way we could try to avoid reimplementing the same algorithms multiple times using different frameworks. Hope that makes sense, thanks.
But would this include GBM algorithms like XGBoost and LightGBM, if not, why not, is this technique inherently impossible with these models?
CEM through the toolkit will work with only differentiable models like NNs, logistic regression etc. since it requires white box access. For the model agnostic version which will work with GBMs, you will have to use Watson Openscale which is a paid IBM offered service.
Hi @sadhamanus do you know if this would be open sourced in the future, I just want to know before I take the effort to do look at developing an open source solution next month.
Its unlikely to be as it is part of a product.
From what I understood, I would not be able to apply this library to a Random Forest model?
If by library you mean the contrastive algorithm then you are right. The open sourced versions require white-box access and the model to be differentiable such as NNs.
I have a multi class problem, where in I have fit a Random Forest model. Was looking for a rule based explanation technique which I could apply. I see a lot of different techniques the AIX360 has implemented. So which one would best suit in my case. Thanks.
So BCRG and GLRM are two rule based methods we have. However, the prior works for binary classification and the latter is for regression. Maybe if you can model your problem accordingly (viz. One vs all classifications or fit to probabilities) and train the rule based methods on the predictions of your RF model could be an alternative.
Adding to what @sadhamanus wrote, the safest option would be to use a one-versus-rest approach where you relabel one of the classes as class 1, the rest as class 0, and fit either BRCG or the LogisticRuleRegression version of GLRM to the relabeled outputs of your RF model. BRCG will give you a rule-based binary classifier (outputs are 0, 1) while LogisticRuleRegression will give you a rule-based logistic regression model (outputs are probabilities in [0, 1]). Fitting them to the outputs of your RF should approximate the RF.
@sadhamanus @dennislwei I first tried applying CEM to my own MLP model but ran into certain issues. To be very specific the CEM was looking for a 'input' layer object on my MLP model and the scikit MLP classifier does not provide a separate input layer object. Could not afford to run a sequential model on the dataset I have on my local system.
I then relabelled my dataset for one-vs-all classification and was successful in applying the BRCG algorithm. I had a question on the BRCG algorithm itself. I have some rules which I obtained from the Anchor method and wanted to compare them with the rules I get from BRCG algorithm. However Anchor is more of a Local interpretation algo. Not sure BRCG is a Global or local interpretation model? Although the way we pass entire dataset to the model looks like it is a Global one. In such a case would it be correct to compare the rules we get from BRCG and Anchor.
Edit: Yes BRCG is Global interpretation technique. Just went through the Readme
Note: I have applied a multi - label Random Forest model to Anchor, and have taken One-vs-rest approach to BRCG.
Yes BRCG produces a globally interpretable model, either from the training data itself or a post-hoc approximation of another model (as you did). As such, for curiosity's sake, you could compare the BRCG rules to the local rules you get from Anchors. But I wouldn't put too much stock in the comparison (unless you dig deeper).