A possibility is to use this cost function L_a(x) = 1/(1+(a/x)²) which at x=a is 0.5, L_a(a)=0.5. (a is a threshold parameter)
L_a(x) = 1/(1+(a/x)²)
x=a
L_a(a)=0.5
a