opendataval.dataval.csshap package#

Submodules#

opendataval.dataval.csshap.csshap module#

class opendataval.dataval.csshap.csshap.ClassWiseShapley(*args, **kwargs)#

Bases: DataEvaluator, ModelMixin

Class-wise shapley data valuation implementation

NOTE only categorical labels is a valid input to Class-Wise Shapley.

References#

Parameters#

samplerSampler, optional

Sampler used to compute the marginal contributions. NOTE the sampler may not use a cache and cache_name should explicitly be passes None. Can be found in sampler, by default uses *args, **kwargs for TMCSampler but removes cache.

evaluate_data_values() ndarray#

Returns data values for CS-Shapley

input_data(x_train: Tensor, y_train: Tensor, x_valid: Tensor, y_valid: Tensor)#

Store and transform input data for CS-Shapley.

Parameters#

x_traintorch.Tensor

Data covariates

y_traintorch.Tensor

Data labels

x_validtorch.Tensor

Test+Held-out covariates

y_validtorch.Tensor

Test+Held-out labels

train_data_values(*args, **kwargs)#

Uses sampler to trains model to find marginal contribs and data values.

For each class, we separate the training and validation data into in-class and out-class. Then we will compute the class-wise shapley values using the sampler. Finally, we record the shapley value in self.data_values.

Module contents#