Thanks for the great work! There is a minor bug here: `pred[probs < threshold] = 0` should be `pred[max_prob < threshold] = 0`. 