logistic regression Flashcards
(32 cards)
What is the main difference between regression and classification?
Regression predicts continuous values; classification predicts discrete labels.
What type of machine learning problem is predicting rainfall?
Regression.
What type of classification problem has exactly two outcomes?
Binary classification.
What is multi-class classification?
Classification with more than two possible categories.
What is multi-label classification?
An input can belong to multiple classes simultaneously.
Is predicting the number of ducks a classification problem?
No, it’s regression.
What function is used in logistic regression to produce probabilities?
The sigmoid function.
What is the formula for the sigmoid function?
g(z) = 1 / (1 + e^-z)
What is the hypothesis function for logistic regression?
hθ(x) = 1 / (1 + e^(-θᵀx))
What does hθ(x) represent in logistic regression?
The probability that y = 1 given input x.
When do we predict class 1 in logistic regression?
When hθ(x) ≥ 0.5.
Why can’t we use linear regression for classification?
Because it can produce outputs outside the [0,1] range.
What is a decision boundary?
The dividing line where the model switches from predicting one class to another.
What equation defines the decision boundary in logistic regression?
θᵀx = 0
What is true when hθ(x) = 0.5?
The model is at the decision boundary.
What kind of decision boundary does logistic regression produce?
A linear boundary.
In the example θ = [-100, 1, 1], when is placement predicted?
When x₁ + x₂ ≥ 100
What cost function does linear regression use?
Mean Squared Error (MSE)
Why is MSE not used in logistic regression?
It creates a non-convex cost surface with the sigmoid function.
What cost function is used in logistic regression?
Log-loss or binary cross-entropy.
What is the formula for log-loss for a single example?
J(θ) = -y log(hθ(x)) - (1 - y) log(1 - hθ(x))
Why is log-loss preferred over MSE in logistic regression?
Because it is convex and reliable to optimize.
What happens to cost when the prediction is confidently wrong?
The cost becomes very high.
What happens to cost when the prediction is confidently correct?
The cost is very low.