interpret_community.common.constants module

Defines constants for interpret community.

class interpret_community.common.constants.Attributes

Bases: object

Provide constants for attributes.

EXPECTED_VALUE = 'expected_value'
class interpret_community.common.constants.DNNFramework

Bases: object

Provide DNN framework constants.

PYTORCH = 'pytorch'
TENSORFLOW = 'tensorflow'
class interpret_community.common.constants.Defaults

Bases: object

Provide constants for default values to explain methods.

AUTO = 'auto'
DEFAULT_BATCH_SIZE = 100
HDBSCAN = 'hdbscan'
MAX_DIM = 50
class interpret_community.common.constants.Dynamic

Bases: object

Provide constants for dynamically generated classes.

GLOBAL_EXPLANATION = 'DynamicGlobalExplanation'
LOCAL_EXPLANATION = 'DynamicLocalExplanation'
class interpret_community.common.constants.ExplainParams

Bases: object

Provide constants for interpret community (init, explain_local and explain_global) parameters.

BATCH_SIZE = 'batch_size'
CHECK_ADDITIVITY = 'check_additivity'
CLASSES = 'classes'
CLASSIFICATION = 'classification'
EVAL_DATA = 'eval_data'
EVAL_Y_PRED = 'eval_y_predicted'
EVAL_Y_PRED_PROBA = 'eval_y_predicted_proba'
EXPECTED_VALUES = 'expected_values'
EXPLAIN_SUBSET = 'explain_subset'
EXPLANATION_ID = 'explanation_id'
FEATURES = 'features'
GLOBAL_IMPORTANCE_NAMES = 'global_importance_names'
GLOBAL_IMPORTANCE_RANK = 'global_importance_rank'
GLOBAL_IMPORTANCE_VALUES = 'global_importance_values'
GLOBAL_NAMES = 'global_names'
GLOBAL_RANK = 'global_rank'
GLOBAL_VALUES = 'global_values'
ID = 'id'
INCLUDE_LOCAL = 'include_local'
INIT_DATA = 'init_data'
IS_ENG = 'is_engineered'
IS_LOCAL_SPARSE = 'is_local_sparse'
IS_RAW = 'is_raw'
LOCAL_EXPLANATION = 'local_explanation'
LOCAL_IMPORTANCE_VALUES = 'local_importance_values'
METHOD = 'method'
MODEL_ID = 'model_id'
MODEL_TASK = 'model_task'
MODEL_TYPE = 'model_type'
NUM_CLASSES = 'num_classes'
NUM_EXAMPLES = 'num_examples'
NUM_FEATURES = 'num_features'
PER_CLASS_NAMES = 'per_class_names'
PER_CLASS_RANK = 'per_class_rank'
PER_CLASS_VALUES = 'per_class_values'
PROBABILITIES = 'probabilities'
SAMPLING_POLICY = 'sampling_policy'
SHAP_VALUES_OUTPUT = 'shap_values_output'
classmethod get_private(explain_param)

Return the private version of the ExplainParams property.

Parameters:
  • cls (ExplainParams) – ExplainParams input class.

  • explain_param (str) – The ExplainParams property to get private version of.

Returns:

The private version of the property.

Return type:

str

classmethod get_serializable()

Return only the ExplainParams properties that have meaningful data values for serialization.

Parameters:

cls (ExplainParams) – ExplainParams input class.

Returns:

A set of property names, e.g., ‘GLOBAL_IMPORTANCE_VALUES’, ‘MODEL_TYPE’, etc.

Return type:

set[str]

class interpret_community.common.constants.ExplainType

Bases: object

Provide constants for model and explainer type information, useful for visualization.

CLASSIFICATION = 'classification'
DATA = 'data_type'
EXPLAIN = 'explain_type'
EXPLAINER = 'explainer'
FUNCTION = 'function'
GLOBAL = 'global'
HAN = 'han'
IS_ENG = 'is_engineered'
IS_RAW = 'is_raw'
LIME = 'lime'
LOCAL = 'local'
METHOD = 'method'
MIMIC = 'mimic'
MODEL = 'model_type'
MODEL_CLASS = 'model_class'
MODEL_TASK = 'model_task'
PFI = 'pfi'
REGRESSION = 'regression'
SHAP = 'shap'
SHAP_DEEP = 'shap_deep'
SHAP_GPU_KERNEL = 'shap_gpu_kernel'
SHAP_KERNEL = 'shap_kernel'
SHAP_LINEAR = 'shap_linear'
SHAP_TREE = 'shap_tree'
TABULAR = 'tabular'
class interpret_community.common.constants.ExplainableModelType(value)

Bases: str, Enum

Provide constants for the explainable model type.

LINEAR_EXPLAINABLE_MODEL_TYPE = 'linear_explainable_model_type'
TREE_EXPLAINABLE_MODEL_TYPE = 'tree_explainable_model_type'
class interpret_community.common.constants.ExplanationParams

Bases: object

Provide constants for explanation parameters.

CLASSES = 'classes'
EXPECTED_VALUES = 'expected_values'
class interpret_community.common.constants.Extension

Bases: object

Provide constants for extensions to interpret package.

BLACKBOX = 'blackbox'
GLASSBOX = 'model'
GLOBAL = 'global'
GREYBOX = 'specific'
LOCAL = 'local'
class interpret_community.common.constants.InterpretData

Bases: object

Provide Data and Visualize constants for interpret core.

BASE_VALUE = 'Base Value'
EXPLANATION_CLASS_DIMENSION = 'explanation_class_dimension'
EXPLANATION_TYPE = 'explanation_type'
EXTRA = 'extra'
FEATURE_LIST = 'feature_list'
GLOBAL_FEATURE_IMPORTANCE = 'global_feature_importance'
INTERCEPT = 'intercept'
LOCAL_FEATURE_IMPORTANCE = 'local_feature_importance'
MLI = 'mli'
MULTICLASS = 'multiclass'
NAMES = 'names'
OVERALL = 'overall'
PERF = 'perf'
SCORES = 'scores'
SINGLE = 'single'
SPECIFIC = 'specific'
TYPE = 'type'
UNIVARIATE = 'univariate'
VALUE = 'value'
VALUES = 'values'
class interpret_community.common.constants.LightGBMParams

Bases: object

Provide constants for LightGBM.

CATEGORICAL_FEATURE = 'categorical_feature'
MIN_DATA_IN_LEAF = 'min_data_in_leaf'
class interpret_community.common.constants.LightGBMSerializationConstants

Bases: object

Provide internal class that defines fields used for MimicExplainer serialization.

IDENTITY = '_identity'
LOGGER = '_logger'
MODEL_STR = 'model_str'
MULTICLASS = 'multiclass'
OBJECTIVE = 'objective'
REGRESSION = 'regression'
TREE_EXPLAINER = '_tree_explainer'
enum_properties = ['_shap_values_output']
nonify_properties = ['_logger', '_tree_explainer']
save_properties = ['_lgbm']
class interpret_community.common.constants.MimicSerializationConstants

Bases: object

Provide internal class that defines fields used for MimicExplainer serialization.

ALLOW_ALL_TRANSFORMATIONS = '_allow_all_transformations'
FUNCTION = 'function'
IDENTITY = '_identity'
INITIALIZATION_EXAMPLES = 'initialization_examples'
LOGGER = '_logger'
MODEL = 'model'
ORIGINAL_EVAL_EXAMPLES = '_original_eval_examples'
PREDICT_PROBA_FLAG = 'predict_proba_flag'
RESET_INDEX = 'reset_index'
TIMESTAMP_FEATURIZER = '_timestamp_featurizer'
enum_properties = ['_shap_values_output']
nonify_properties = ['_logger', 'model', 'function', 'initialization_examples', '_original_eval_examples', '_timestamp_featurizer']
save_properties = ['surrogate_model']
class interpret_community.common.constants.ModelTask(value)

Bases: str, Enum

Provide model task constants. Can be ‘classification’, ‘regression’, or ‘unknown’.

By default the model domain is inferred if ‘unknown’, but this can be overridden if you specify ‘classification’ or ‘regression’.

Classification = 'classification'
Regression = 'regression'
Unknown = 'unknown'
class interpret_community.common.constants.ResetIndex(value)

Bases: str, Enum

Provide index column handling constants. Can be ‘ignore’, ‘reset’ or ‘reset_teacher’.

By default the index column is ignored, but you can override to reset it and make it a feature column that is then featurized to numeric, or reset it and ignore it during featurization but set it as the index when calling predict on the original model.

Ignore = 'ignore'
Reset = 'reset'
ResetTeacher = 'reset_teacher'
class interpret_community.common.constants.SHAPDefaults

Bases: object

Provide constants for default values to SHAP.

INDEPENDENT = 'independent'
class interpret_community.common.constants.SKLearn

Bases: object

Provide scikit-learn related constants.

EXAMPLES = 'examples'
LABELS = 'labels'
PREDICTIONS = 'predictions'
PREDICT_PROBA = 'predict_proba'
class interpret_community.common.constants.Scipy

Bases: object

Provide scipy related constants.

CSR_FORMAT = 'csr'
class interpret_community.common.constants.ShapValuesOutput(value)

Bases: str, Enum

Provide constants for the SHAP values output from the explainer.

Can be ‘default’, ‘probability’ or ‘teacher_probability’. If ‘teacher_probability’ is specified, we use the probabilities from the teacher model.

DEFAULT = 'default'
PROBABILITY = 'probability'
TEACHER_PROBABILITY = 'teacher_probability'
class interpret_community.common.constants.Spacy

Bases: object

Provide spaCy related constants.

EN = 'en'
NER = 'ner'
TAGGER = 'tagger'
class interpret_community.common.constants.Tensorflow

Bases: object

Provide TensorFlow and TensorBoard related constants.

CPU0 = '/CPU:0'
TFLOG = 'tflog'