Data Science Interview Preparation

🚀 Crack FAANG Interviews: Master Logistic Regression with This 3-Level Quiz Challenge (Score 90%+ to Prove You're Ready!)

Logistic Regression Quiz - Advanced Level

Logistic Regression Quiz - Advanced Level

Q1. What optimization algorithm is most commonly used in logistic regression implementations like scikit-learn?

A) Gradient Descent
B) 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 class
B) 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 scaled
B) 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) Convex
B) Concave
C) Non-differentiable
D) Non-convex

Q5. Which technique is best for calibrating predicted probabilities in logistic regression?

A) Label encoding
B) 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-entropy
B) 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 matrices
B) 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 gradient
B) 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 relationship
B) 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 kernels
B) It draws linear decision boundaries in input space
C) It models data distribution directly
D) It has linear loss function

Answer Explanations:

  1. LBFGS is a quasi-Newton method and default in scikit-learn.
  2. Automatically adjusts class weights based on their frequencies.
  3. Regularization gets distorted without scaling, impacting performance.
  4. A convex function allows finding the global minimum using gradient methods.
  5. These methods adjust model outputs to better match actual probabilities.
  6. Multiclass logistic regression minimizes categorical cross-entropy.
  7. High-dimensionality increases overfitting risk without regularization.
  8. Large negative values can cause underflow in `exp()` during sigmoid computation.
  9. A high positive coefficient strongly pushes the output towards class 1.
  10. Logistic regression uses a linear combination of inputs to create decision boundaries.
'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();
Theme images by Barcin. Powered by Blogger.