The bi-tempered logistic loss makes softmax regression robust to label noise with two temperatures: bounds the loss of far-away mislabeled points, gives the output transfer function heavier tails.
Implement (all inputs may be NumPy arrays; work element-wise):
log_t(x, t) for , and for .exp_t(x, t) for (where ), and for .tempered_softmax(a, t) for logits a of shape (N, C) and : return where the per-row scalar solves . Rows must sum to 1 within . For this is the ordinary softmax.bi_tempered_loss(labels, a, t1, t2): labels are integer classes, a are logits (N, C). With tempered_softmax(a, t2), return the per-row losses (shape (N,))
With the loss must equal the usual softmax cross-entropy.