Sigmoid produces a continuous confidence, but an application often needs a discrete class. Thresholding turns every probability into the label convention used by the rest of the classifier while allowing a caller to choose a stricter or looser cutoff.
Implement predict_labels(p, threshold=0.5) with one vectorized comparison. Theory states which side of the boundary includes an exact tie.
p may be any array shape; return labels of exactly that shape.0 and 1 values, not a Boolean array.threshold=0.5 by default and honor a supplied threshold.p.Open one at a time. Each gives away a little more than the last.
A NumPy comparison already returns one Boolean result per element.
Use the inclusive comparison, then convert the Boolean result to an integer dtype.
No results yet
Run your code to check it against the examples, or submit to run every test.