Why 1 minus accuracy_7s in Lesson 3 @ 1:39:21

accuracy_3s = is_3(valid_3_tens).float() .mean()
accuracy_7s = (1 - is_3(valid_7_tens).float()).mean()

Why do we do add the “1” to accuracy_7s.

This is discuss on Lesson 3 @ 1:39:21

we take inverse for 7s, because we use the same function is_3 to calculate accuracy for both 3s and 7s. We have only 3s and 7s in our dataset.
optionally we could create another function is_7 and then we wouldn’t need to inverse the result.

1 Like

is_3(valid_7_tens)

will return the number of times that the is_3 function is returning false. This would be appropriate if we were interested in error rate for 3s. However we want the number of times the 7s are correctly identified.

This can be done by subtracting from 1:

1 - is_3(valid_7_tens)

1 Like

Well , if you go ahead and do this

accuracy_7s = is_3(valid_7_tens).float().mean()

the resulting mean will give you accuracy of incorrect results. Now to get accuracy of correct results , resulting mean needs to be subtracted from 1.
Hope it will answer your question