Why not linear regression for yes or no
You want to predict pass (1) or fail (0). A straight line will happily output 1.4 or -0.2, and neither is a valid answer. It also has no notion of confidence.
Logistic regression fixes this by squeezing the line's output through the sigmoid function:
import numpy as np
def sigmoid(z):
return 1 / (1 + np.exp(-z))
print(sigmoid(np.array([-6, -2, 0, 2, 6])).round(4))
# [0.0025 0.1192 0.5 0.8808 0.9975]
Any input, from minus infinity to plus infinity, comes out between 0 and 1. That output is read as a probability. Above 0.5 you call it class 1, below 0.5 class 0. Despite the name, logistic regression is a classifier.