To this end, we instead define the confidence e(x, S) as the difference between the distances from x to each category of S: Here S + and S − stand for the positive space and negative space of S respectively.
if x is either far away from S (i.e., x is not in the manifold of S) or near the classification boundary, we will get a small e(x, S) indicating a low confidence to the corresponding prediction.