PyMint can create the summary and dependence plots from the shap python package, but is adapted for multiple predictors and an easier user interface. In future work, PyMint will also include DeepSHAP for convolution neural network-based models. PyMint employs both KernelSHAP for any model and TreeSHAP for tree-based methods. To explain specific examples, you can use SHAP values.
Install jupyter notebook on mint code#
plot_ale ( ale )Īdditionally, you can use the same code snippet to compute the second-order ALE (see the notebook for more details). ale ( features = important_vars, n_bins = 20 ) explainer. get_important_vars ( results, multipass = True, nvars = 7 ) ale = explainer. permutation_importance has already been run. It is also possible to configure the plot for readable feature names. For the choice of feature, you can manually select or can run the permutation importance and a built-in method will retrieve those features. There is also an option for second-order interaction effects. To compute the expected functional relationship between a feature and an ML model's prediction, you can use partial dependence or accumulated local effects.
Sample notebook can be found here: Permutation Importance Partial dependence and Accumulated Local Effects permutation_importance ( n_vars = 10, evaluation_fn = 'auc' ) explainer.
In the tutorial it discusses options to make the figure publication-quality giving the plotting methodĪdditional argument to convert the feature names to a more readable format or color coding by feature type. We can calculate the permutation importance and then plot the results. InterpretToolkit ( estimators = estimators, X = X, y = y ,) Permutation Importanceįor predictor ranking, PyMint uses both single-pass and multiple-pass permutation importance method ( Lakshmanan et al. import pymint # Loads three ML models (random forest, gradient-boosted tree, and logistic regression) # trained on a subset of the road surface temperature data from Handler et al. Once initialized InterpretToolkit canĬompute a variety of interpretability methods and plot them. The interface of PyMint is the InterpretToolkit, which houses the computations and plotting methodsįor all the interpretability methods contained within. PyMint requires the following packages: numpy PyMint is compatible with Python 3.6 or newer. PyMint can be installed through pip, but we are working on uploading to conda-forge. If you are experiencing issues with loading the tutorial jupyter notebooks, you can enter the URL/location of the notebooks into the following address. If you employ PyMint in your research, please cite this github and the relevant packages listed above. Here is a list of packages used in PyMint:
Our goal is not take credit from other code authors, but to make a single source for computing several machine learning interpretation methods. This package is largely original code, but also includes snippets or chunks of code from preexisting packages. The package is under active development and will likely contain bugs or errors. Documentation for PyMint can be found at. The primary feature of this package is the accompanying built-in plotting methods, which are desgined to be easy to use while producing publication-level quality figures. Most calculations can be performed in parallel when multi-core processing is available.