Logistic Regression
Logistic Regression
Why Sigmoid?
The sigmoid function converts any real number into a
probability.
It helps in classification by setting a decision boundary at
0.50.50.5.
Graph of the Sigmoid Function
When z is large (positive), g(z) approaches 1.
• Hypothesis function:
2. Initialize parameters: θ0 = 0, θ1 = 0.
3. Compute hypothesis function using sigmoid.
4. Compute cost function using log loss.
5. Apply gradient descent to update parameters.
6. Make a prediction for a student who studied 3.5
hours.
Step 1: Define the Logistic Regression
Model
The logistic regression equation is:
• where:
• h(x) is the probability that the student will pass
(y=1).
• θ0and θ1 are the parameters we need to
estimate.
Step 2: Initialize Parameters
Step 3: Compute Hypothesis Function
• Initial params: θ0=0, θ1=0
• Using the sigmoid function & Since θ0=0,
θ1=0.