How to determine threshold in Sigmoid function
As per Andrew Ng's Course, if you use the sigmoid activation, the outputs represent the probability of either outcome 0 or outcome 1.

So the decision boundary is 0.5

if prediction > 0.5 , the prediction is 1 

if prediction &lt;= 0.5 , the prediction in 0

Here's a screenshot from Andrew Ng's slides:



I have gone through your code and results. There seems to be something wrong with the implementation as none of your predictions give a value greater than 0.5 .

I couldn't pin down the problem. Some debugging will be needed on your side. 

What's paradoxical is that your loss is reducing. I suspect this might be because your data set is unbalanced i.e., you have 221 0s and about 30 1s. This could be the reason for other problems as well.

Consider the wikipedia example, where the values are correctly matching.


If you manage to find the error or the solution conclusively, please post it here so that we can all learn.

Hope this helps!