Oh sorry for not making it clear.
I’ve just set the threshold in my demo code to zero, as torch.randn samples from a normal distribution with zero mean. The threshold should therefore divide the samples in two classes with approx. the same amount of samples.
In your code your error distribution will look differently and you should adjust the threshold.
As far as I’ve understood your use case, you expect two clusters of errors, i.e. good and bad predictions.
You have to calculate or estimate this threshold.