autoprognosis.plugins.explainers.plugin_symbolic_pursuit module

class SymbolicPursuitPlugin(estimator: Any, X: pandas.core.frame.DataFrame, y: pandas.core.frame.DataFrame, task_type: str = 'classification', feature_names: Optional[List] = None, subsample: int = 10, prefit: bool = False, n_epoch: int = 10000, time_to_event: Optional[pandas.core.frame.DataFrame] = None, eval_times: Optional[List] = None, loss_tol: float = 0.001, ratio_tol: float = 0.9, maxiter: int = 100, eps: float = 1e-05, patience: int = 10, random_state: int = 0, **kwargs: Any)

Bases: autoprognosis.plugins.explainers.base.ExplainerPlugin

Interpretability plugin based on Symbolic Pursuit.

Based on the NeurIPS 2020 paper “Learning outside the black-box: at the pursuit of interpretable models”.

Parameters
  • estimator – model. The model to explain.

  • X – dataframe. Training set

  • y – dataframe. Training labels

  • task_type – str. classification or risk_estimation

  • prefit – bool. If true, the estimator won’t be trained.

  • n_epoch – int. training epochs

  • subsample – int. Number of samples to use.

  • time_to_event – dataframe. Used for risk estimation tasks.

  • eval_times – list. Used for risk estimation tasks.

  • loss_tol – float. The tolerance for the loss under which the pursuit stops

  • ratio_tol – float. A new term is added only if new_loss / old_loss < ratio_tol

  • maxiter – float. Maximum number of iterations for optimization

  • eps – float. Number used for numerical stability

  • random_state – float. Random seed for reproducibility

Example

>>> import pandas as pd
>>> from sklearn.datasets import load_iris
>>> from sklearn.model_selection import train_test_split
>>>from autoprognosis.plugins.explainers import Explainers
>>> from autoprognosis.plugins.prediction.classifiers import Classifiers
>>>
>>> X, y = load_iris(return_X_y=True)
>>>
>>> X = pd.DataFrame(X)
>>> y = pd.Series(y)
>>>
>>> X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
>>> model = Classifiers().get("logistic_regression")
>>>
>>> explainer = Explainers().get(
>>>     "symbolic_pursuit",
>>>     model,
>>>     X_train,
>>>     y_train,
>>>     task_type="classification",
>>> )
>>>
>>> explainer.explain(X_test)
explain(X: pandas.core.frame.DataFrame) numpy.ndarray
static name() str
plot(X: pandas.core.frame.DataFrame) tuple
static pretty_name() str
static type() str
plugin

alias of autoprognosis.plugins.explainers.plugin_symbolic_pursuit.SymbolicPursuitPlugin