BayLIME extension (visualime.baylime)

BayLIME (Bayesian Local Interpretable Model-Agnostic Explanations) [1] is an extension of LIME [2] that exploits prior knowledge and Bayesian reasoning.

[1] Zhao et al. (2021): BayLIME: Bayesian Local Interpretable Model-Agnostic Explanations. arXiv:2012.03058

[2] Ribeiro et al. (2016): “Why Should I Trust You?”: Explaining the Predictions of Any Classifier. arXiv:1602.04938

class visualime.baylime.BayesianRidgeFixedLambda(*, epsilon: float = 1e-06, large_number: float = 1000000000.0, **kwargs)[source]

Bases: BayesianRidge

BayesianRidge model with fixed parameter lambda. This is equivalent to the “partial informative priors” option in the BayLIME framework.

The value for lambda_init will be treated as a constant. The parameter epsilon specifies the maximum amount of change allowed for lambda. A warning will be issued if this amount is exceeded. To reduce the amount of change in lambda, increase large_number.

See the documentation for sklearn.linear_model.BayesianRidge() for a list of available parameters.

Methods

fit(X, y[, sample_weight])

Fit the model.

get_params([deep])

Get parameters for this estimator.

predict(X[, return_std])

Predict using the linear model.

score(X, y[, sample_weight])

Return the coefficient of determination of the prediction.

set_params(**params)

Set the parameters of this estimator.

fit(X, y, sample_weight=None)[source]

Fit the model.

Parameters:
Xndarray of shape (n_samples, n_features)

Training data.

yndarray of shape (n_samples,)

Target values. Will be cast to X’s dtype if necessary.

sample_weightndarray of shape (n_samples,), default=None

Individual weights for each sample.

New in version 0.20: parameter sample_weight support to BayesianRidge.

Returns:
selfobject

Returns the instance itself.

class visualime.baylime.BayesianRidgeFixedAlphaLambda(*, epsilon: float = 1e-06, large_number: float = 1000000000.0, **kwargs)[source]

Bases: BayesianRidge

BayesianRidge model with fixed parameters alpha and lambda. This is equivalent to the “full informative priors” option in the BayLIME framework.

The values for alpha_init and lambda_init will be treated as constants.

The parameter epsilon specifies the maximum amount of change allowed for alpha and lambda. A warning will be issued if this amount is exceeded. To reduce the amount of change, increase large_number.

See the documentation for sklearn.linear_model.BayesianRidge() for a list of available parameters.

Methods

fit(X, y[, sample_weight])

Fit the model.

get_params([deep])

Get parameters for this estimator.

predict(X[, return_std])

Predict using the linear model.

score(X, y[, sample_weight])

Return the coefficient of determination of the prediction.

set_params(**params)

Set the parameters of this estimator.

fit(X, y, sample_weight=None)[source]

Fit the model.

Parameters:
Xndarray of shape (n_samples, n_features)

Training data.

yndarray of shape (n_samples,)

Target values. Will be cast to X’s dtype if necessary.

sample_weightndarray of shape (n_samples,), default=None

Individual weights for each sample.

New in version 0.20: parameter sample_weight support to BayesianRidge.

Returns:
selfobject

Returns the instance itself.