shapiq.imputer.GaussianCopulaImputer¶
- class shapiq.imputer.GaussianCopulaImputer(model, data, x=None, *, sample_size=100, random_state=None, verbose=False)[source]¶
Bases:
GaussianImputerImplements the Gaussian copula-based approach for imputation according to [Aas21].
This method models feature dependence using a Gaussian copula, separating the modeling of marginal distributions from their joint dependence structure. Each feature is first transformed to follow a standard normal distribution by applying the empirical cumulative distribution function (CDF), followed by the standard normal quantile function.
Monte Carlo samples are then drawn from the conditional multivariate normal distribution in this transformed (Gaussian) space, given the observed values in a coalition. These samples are finally transformed back to the original feature space using the inverse of the empirical CDFs.
Initializes the GaussianCopulaImputer.
- Parameters:
model (
object|Game|Callable[[ndarray[tuple[Any,...],dtype[floating]]],ndarray[tuple[Any,...],dtype[floating]]]) – The model to explain as a callable function expecting a data points as input and returning the model’s predictions.data (
ndarray[tuple[Any,...],dtype[floating]]) – The background data to use for the explainer as a two-dimensional array with shape(n_samples, n_features).x (
ndarray[tuple[Any,...],dtype[floating]] |None) – The explanation point as anp.ndarrayof shape(1, n_features)or(n_features,).sample_size (
int) – The number of Monte Carlo samples to draw from the conditional background data for imputation.random_state (
int|None) – An optional random seed for reproducibility.verbose (
bool) – A flag to enable verbose imputation, which will print a progress bar for model evaluation. Note that this can slow down the imputation process.
- QUANTILE_CLIP_EPSILON = 1e-10¶
Used for clipping values to the ‘exclusive range’
(0, 1)when evaluating a quantile function.More specifically, values will be clipped to the range
[epsilon, 1 - epsilon].