Interpretation AI and explanation AI of Titanic SpaceShip predictions
Interpretation AI and explanation AI of Titanic SpaceShip predictions
Introduction:
In the last tutorial here https://smartpredict.ai/blog/smartpredict/tita, we’ve seen Kaggle’s baseline project with SmartPredict with the Titanic SpaceShip dataset. Here is a new tutorial where we will learn how to interpret the model and explain a single prediction by using SmartPredict. Interpretable AI or explainable AI allows us to identify which feature is influential in the model’s prediction and helps us understand how machine learning models make decisions that can be understood by a human. This method can improve the trust in the model’s decisions. It is important to know how a given model makes certain predictions. SmartPredict provides interpretability and explainability solutions.
So let’s get started :)
Let’s keep our last project with the Titanic SpaceShip dataset.
Interpretations AI: global methods
Model Interpreter module
Global methods are those that attempt to explain the whole model. SmartPredict has a module for model global interpretation: the “Model Interpreter” module.
We can put this module between the model trainer and the model evaluator modules.
This module takes as input :
-the trained model to be interpreted
-the features used in model training
-the label used in model training
-the features for validation
-the label for validation
This module generates 1 output: the interpreted model
Model properties:
We can see model proprieties by clicking on the “Properties” option on the trained model.
We obtain three tabs:
-Summary
-Evaluation
-Interpretation
Summary:
On this tab, you will find summaries and descriptions of the model.
Evaluation:
This tab shows the metrics score selected on the "Model Evaluator" module, along with its values. Since it is a classification problem, we have additional plots such as the ROC curve, confusion matrix, and lift chart. All of these plots can be seen in the left tab.
Interpretation:
This tab shows model interpretation containing the following:
Permutation feature importance
By using this functionality, we can show the importance of each feature in descending order.
Partial Dependency Plot:
A PDP enables visualization of the impact or effect of the feature of interest across all data points.
Partial Dependency Plot in 2-dimensions:
Using a 2-D plot of partial dependence, we can see how the combination of two features affects the label.
Features interaction plot:
Interaction between features is among the main issues in interpretable machine learning.
In order to access model properties, we can go to the "Trained Models" menu and search for the name of our model.
On the right side, click the "Properties" option.
Each global method is described briefly.
Model explanations: local methods
Build space:
Now let's move on to the explanation of models. Local methods train interpretable models to approximate the individual predictions.
In the “Model Trainer” module, let’s check the “Generate explanations” box.
We can re-run our flowchart now in order to generate explications.
Deploy space:
Afterward, we can translate the flowchart and start deployment.
The "Features selector" module can be removed, as it is not necessary for the deployment.
Also check the "Generate explanations" parameter in the "Model Predictor" module and our desired methods for generating explanations: SHAP plot, LIME plot, and counterfactual explanations table.
Change the model trained instance and the processing pipeline instance.
Continue by deploying as a web service.
Go to the monitor space and verify if the web service is ready before sending a request.
Predict space:
After sending the request, we obtain outputs in the explanations tab:
Shapley Additive exPlanations or SHAP plot: for showing the contribution of each feature to the prediction.
Local Interpretable Model-agnostic Explanations or LIME plot: used to show significant features along with their bounding values.
Counterfactual explanations help us to understand an ML model by generating “what-if” data points that lead to the desired model output.
Conclusion:
Congratulations! You have just interpreted and explained the Machine Learning model, as well as different global and local methods to explain each instance with such as permutation feature importance, partial dependency plot, partial dependency 2-D plot, features interaction, SHAP, LIME, and counterfactuals table. These tools can be used to provide clear and understandable explanations of the reasoning that led to the model’s output.
Thank you!!