Tools for training classifiers when class counts have a long tail.
Implement:
class_sampling_probs(counts, q): the probability of drawing a training example from class , (so is instance-balanced, square-root, class-balanced sampling).prior_bias(counts): a bias vector with ; return .logit_adjust(logits, class_prior, tau=1.0): subtract from column of an (N, C) logit matrix (class priors sum to 1).balanced_accuracy(y_true, y_pred, C): the mean over classes of per-class recall (the fraction of class- examples predicted as ). Every class appears in y_true.Return NumPy arrays from the first three and a float from the last.