src.model.tdcomp.classwise_sampler

Classes

ClasswiseSampler(**kwargs)

class src.model.tdcomp.classwise_sampler.ClasswiseSampler(**kwargs)
Author:

Alberto M. Esmoris Pena

Training data component based on sampling from the input training data to satisfy a given class-wise distribution.

The model arguments of a Classwise sampler are:

target_class_distribution - list of int

The target distribution for each class.

replace - bool

Whether to compute the sampling with replacement (i.e., repeating data points is allowed) or not.

__init__(**kwargs)

Initialize the class-wise sampler training data component.

Parameters:

kwargs – The attributes for the class-wise training data component.

__call__(X, y)

Apply the class-wise sampler to transform the input training data.

See TrainingDataComponent.__call__().

compute_classwise_sampling(X, y)

Compute the class-wise sampling on the given input.

Parameters:
  • X – The features of the training data points.

  • y – The expected classes of the training data points.

Returns:

The transformed training data.

Return type:

tuple (X, y)