Back to the lessonPreparing the printout…

Fundamental of Machine Learning · Module 2: Core Machine Learning Algorithms

2.2 Logistic Regression

[video] /api/lesson-media/videos/9b417aa2-5e9f-4ae3-a9db-2a3b7f03f372-1794614886261-23f121f6cdfad587.mp4

[markdown] content available only on the platform

[markdown] content available only on the platform

Flashcards · 2.2 Logistic Regression

Logistic Regression — A classification algorithm that predicts the probability of a class with the sigmoid function, then assigns a label using a threshold.

Predicting Junior (0) or Senior (1) from salary.

Sigmoid function — The S-shaped function 1 / (1 + e^(-z)) that maps any number to a value strictly between 0 and 1.

sigmoid(0) = 0.5; sigmoid(4) is about 0.98.

Threshold — The cut-off compared with the predicted probability to decide the label; usually 0.5.

Probability 0.9 > 0.5, so the label is Senior.

Predicted probability — The sigmoid output, read as how likely the sample belongs to the positive class.

0.9 means a 90% probability that the person is Senior.

Binary classification — A task with exactly two possible categories, often coded as 0 and 1.

Junior = 0, Senior = 1.

Transition zone — The middle part of the sigmoid curve where the probability rises steeply and predictions are least certain.

Mid-range salaries with probabilities around 0.5.

LogisticRegression — The scikit-learn class for Logistic Regression; used for classification problems despite its name.

LogisticRegression().fit(x_train, y_train)

predict_proba() — A classifier method that returns the predicted probability of each class for every sample.

model.predict_proba(x_test)[:, 1] gives P(Senior).

Fundamental of Machine Learning · 2.2 Logistic Regression · printed on November 20, 2026