ertk.classification.get_balanced_class_weights

ertk.classification.get_balanced_class_weights(classes: List[int] | ndarray)

Gets class weights such that each class has the same total weight across all instances.

Parameters:
classes: list or array

Sequence of classes of length n_samples.

Returns:
class_weights: np.ndarray

Array of class weights of length n_classes.