autoprognosis.plugins.explainers.plugin_invase module
- class INVASEPlugin(estimator: Any, X: pandas.core.frame.DataFrame, y: pandas.core.frame.DataFrame, time_to_event: Optional[pandas.core.frame.DataFrame] = None, eval_times: Optional[List] = None, feature_names: Optional[List] = None, n_epoch: int = 10000, n_epoch_inner: int = 2, n_folds: int = 5, task_type: str = 'classification', samples: int = 2000, prefit: bool = False, random_state: int = 0)
Bases:
autoprognosis.plugins.explainers.base.ExplainerPlugin
Interpretability plugin based on the INVASE algorithm.
- Parameters
estimator – model. The model to explain.
X – dataframe. Training set
y – dataframe. Training labels
time_to_event – dataframe. Used for risk estimation tasks.
eval_times – list. Used for risk estimation tasks.
n_epoch – int. training epochs
task_type – str. classification or risk_estimation
samples – int. Number of samples to use.
prefit – bool. If true, the estimator won’t be trained.
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( >>> "invase", >>> model, >>> X_train, >>> y_train, >>> task_type="classification", >>> ) >>> >>> explainer.explain(X_test)
- explain(X: pandas.core.frame.DataFrame) numpy.ndarray
- static name() str
- plot(values: pandas.core.frame.DataFrame) None
- static pretty_name() str
- static type() str
- class Masking(*args: Any, **kwargs: Any)
Bases:
torch.nn.Module
- forward(tensors: List[torch.Tensor]) torch.Tensor
- bitmask_intervals(n: int, low: int, high: int) Generator
- bitmasks(n: int, m: int) Generator
- class invaseBase(estimator: Any, X: numpy.ndarray, n_epoch: int = 10000, n_epoch_inner: int = 1, patience: int = 5, min_epochs: int = 100, n_epoch_print: int = 50, batch_size: int = 300, learning_rate: float = 0.001, penalty_l2: float = 0.001, feature_names: List = [])
Bases:
object
- abstract explain(X: numpy.ndarray, *args: Any, **kwargs: Any) numpy.ndarray
- class invaseCV(estimator: Any, X: numpy.ndarray, critic_latent_dim: int = 200, n_epoch: int = 10000, n_epoch_inner: int = 2, patience: int = 5, min_epochs: int = 100, n_epoch_print: int = 50, n_folds: int = 5, seed: int = 42, feature_names: List = [])
Bases:
object
- explain(x: numpy.ndarray) numpy.ndarray
- class invaseClassifier(estimator: Any, X: numpy.ndarray, critic_latent_dim: int = 200, n_epoch: int = 10000, n_epoch_inner: int = 2, patience: int = 5, min_epochs: int = 100, n_epoch_print: int = 50, batch_size: int = 300, learning_rate: float = 0.001, penalty_l2: float = 0.001, feature_names: List = [])
Bases:
autoprognosis.plugins.explainers.plugin_invase.invaseBase
- explain(X: numpy.ndarray, *args: Any, **kwargs: Any) numpy.ndarray
- class invaseRiskEstimation(estimator: Any, X: numpy.ndarray, eval_times: List, critic_latent_dim: int = 200, n_epoch: int = 10000, n_epoch_inner: int = 2, patience: int = 5, min_epochs: int = 100, n_epoch_print: int = 10, batch_size: int = 500, learning_rate: float = 0.001, penalty_l2: float = 0.001, samples: int = 20000, feature_names: List = [])
Bases:
autoprognosis.plugins.explainers.plugin_invase.invaseBase
- explain(X: numpy.ndarray, *args: Any, **kwargs: Any) numpy.ndarray
- plugin
alias of
autoprognosis.plugins.explainers.plugin_invase.INVASEPlugin
- sample(X: numpy.ndarray, nsamples: int = 100, random_state: int = 0) numpy.ndarray