Return the per-sample weight needed to make a WeightedRandomSampler draw each class with equal probability.
Signature: def balanced_weights(labels: list) -> list
Weight for sample i is 1 / count(class_of_sample_i). Return a list of floats the same length as labels.
Math
Asked at
Test Results