Skip to content

Commit 4188336

Browse files
Use ternary operator for binary prediction
1 parent b607f7f commit 4188336

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

computer_vision/cnn_classification.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,4 @@
9696
# training_set.class_indices
9797
# The sigmoid output is a probability in the range [0, 1].
9898
# Use a threshold of 0.5 to convert the probability into a binary prediction.
99-
if result[0][0] < 0.5:
100-
prediction = "Normal"
101-
else:
102-
prediction = "Abnormality detected"
99+
prediction = "Normal" if result[0][0] < 0.5 else "Abnormality detected"

0 commit comments

Comments
 (0)