SHAP

ExpyBox.shap()

Create dialog for shap, providing force and decision plots

Returns

None

Method parameters

  • Plot

    Which plot to draw decision, force or both

  • Background data

    What background data will be used to sample from, when simulating “missing” feature

    • KMeans: use KMeans to sample from provided dataset

    • Custom variable: provide variable (that is in kernel_globals) with instances to use

  • Count of KMeans centers

    Number of means to use when creating background data. Only used if Background data is set to KMeans

  • Background data variable

    Variable with background data from which the “missing” features will be sampled. Only used if Background data is set to Custom variable

  • Link

    A generalized linear model link to connect the feature importance values to the model output

    Since the feature importance values, phi, sum up to the model output, it often makes sense to connect them to the ouput with a link function where link(outout) = sum(phi).

    If the model output is a probability then the LogitLink link function makes the feature importance values have log-odds units.

  • Model sample size

    Number of times to re-evaluate the model when explaining each prediction.

    More samples lead to lower variance estimates of the SHAP values.

  • Auto choose model sample size

    The auto setting uses Model sample size = 2 * train_data.shape[1] + 2048.

  • L1 regularization

    The l1 regularization to use for feature selection (the estimation procedure is based on a debiased lasso).

    You can choose following inputs:

    • The auto option currently uses “aic” when less that 20% of the possible sample space is enumerated, otherwise it uses no regularization.

    • The aic or bic options use the AIC and BIC rules for regularization

    • Integer selects a fix number of top features

    • float directly sets the “alpha” parameter of the sklearn.linear_model.Lasso model used for feature selection

  • Class to plot

    If explaining classification problem, select which class prediction to explain