ertk.classification.get_balanced_sample_weights

ertk.classification.get_balanced_sample_weights(labels: List[int] | ndarray)

Gets sample weights such that each unique label has the same total weight across all instances.

Parameters:
labels: list or array

Sequence of labels of length n_samples.

Returns:
sample_weights: np.ndarray

Array of sample weights of length n_samples.