🚀 Crack FAANG Interviews: Master Logistic Regression with This 3-Level Quiz Challenge (Score 90%+ to Prove You're Ready!)
Logistic Regression Quiz - Advanced Level
Q1. What optimization algorithm is most commonly used in logistic regression implementations like scikit-learn?
A) Gradient DescentB) Newton-Raphson (LBFGS)
C) Stochastic Gradient Descent
D) Expectation-Maximization
Q2. When using logistic regression with imbalanced data, what does the class_weight='balanced' parameter do?
A) Ignores majority classB) Undersamples the majority class
C) Weights inversely proportional to class frequencies
D) Applies bootstrapping to minority class
Q3. What happens if you don’t scale features before applying L2-regularized logistic regression?
A) Features are automatically scaledB) No change in results
C) Features with larger magnitudes dominate the penalty
D) Model accuracy increases
Q4. In the context of logistic regression, the log-likelihood function is:
A) ConvexB) Concave
C) Non-differentiable
D) Non-convex
Q5. Which technique is best for calibrating predicted probabilities in logistic regression?
A) Label encodingB) K-fold cross-validation
C) Platt scaling or isotonic regression
D) Feature binning
Q6. In multinomial logistic regression, which loss function is minimized?
A) Binary cross-entropyB) Hinge loss
C) Categorical cross-entropy (Softmax loss)
D) Mean squared error
Q7. Which of the following is a major drawback of logistic regression for high-dimensional, sparse data?
A) It cannot run on sparse matricesB) It performs poorly without Gaussian assumptions
C) It lacks interpretability
D) It may overfit without strong regularization
Q8. What is a numerical stability issue commonly encountered in logistic regression implementation?
A) Division by zero in gradientB) Computing sigmoid on large negative inputs
C) Non-determinism in weights
D) Overflow in mean calculation
Q9. What does a very large positive coefficient (β) in logistic regression suggest for a feature?
A) Strong inverse relationshipB) Insignificant predictor
C) Strong positive influence on the log-odds
D) Correlated with other features
Q10. Why is logistic regression considered a linear classifier?
A) It uses polynomial kernelsB) It draws linear decision boundaries in input space
C) It models data distribution directly
D) It has linear loss function
Answer Explanations:
- LBFGS is a quasi-Newton method and default in scikit-learn.
- Automatically adjusts class weights based on their frequencies.
- Regularization gets distorted without scaling, impacting performance.
- A convex function allows finding the global minimum using gradient methods.
- These methods adjust model outputs to better match actual probabilities.
- Multiclass logistic regression minimizes categorical cross-entropy.
- High-dimensionality increases overfitting risk without regularization.
- Large negative values can cause underflow in `exp()` during sigmoid computation.
- A high positive coefficient strongly pushes the output towards class 1.
- Logistic regression uses a linear combination of inputs to create decision boundaries.