Logistic RegressionCode with Python
Here is Kavya ma'am's model in Python with scikit-learn. It looks almost the same as linear regression — only the model's name changes.
model.predict_proba(...)gives the chances of each group;[0][1]picks the chance of group 1, "passed".model.predict(...)applies the threshold 0.5 and answers 1 or 0.
scikit-learn adds a small penalty on large weights by default (called regularisation), so its curve is a little gentler than ours: it finds instead of 1.02. Run the program, then try a different number of hours.
The S-Curve, Without a Library
Once and are known, the model is only a few lines of plain Python: a straight line, then the sigmoid. Try 4.3 hours — it lands right on the decision boundary.