InterviewStack.io LogoInterviewStack.io

Linear and Logistic Regression Implementation Questions

Covers the fundamentals and implementation details of linear regression for continuous prediction and logistic regression for binary or multiclass classification. Candidates should understand model formulation, hypothesis functions, and the intuition behind fitting a line or hyperplane for regression and using a sigmoid or softmax function for classification. Include loss functions such as mean squared error for regression and cross entropy loss for classification, optimization methods including gradient descent and variants, regularization techniques, feature engineering and scaling, metrics for evaluation such as mean absolute error and accuracy and area under curve, and hyperparameter selection and validation strategies. Expect discussion of practical implementation using numerical libraries and machine learning toolkits, trade offs and limitations of each approach, numerical stability, and common pitfalls such as underfitting and overfitting.

HardTechnical
0 practiced
Derive how Platt scaling fits a sigmoid to classifier scores to map them to calibrated probabilities. Implement Platt scaling by fitting a 2-parameter logistic regression on held-out calibration data and explain why regularization (a small prior) may be necessary when calibration data is small.
EasyTechnical
0 practiced
Compare mean squared error (MSE) and mean absolute error (MAE) as loss functions for regression. Provide mathematical definitions, discuss sensitivity to outliers, differentiability/smoothness and implications for gradient-based optimization, and business scenarios where MAE is preferred over MSE or vice versa.
MediumTechnical
0 practiced
Implement a simple forward feature selection procedure for linear regression that greedily adds features which improve validation error. Describe termination criteria (max features, improvement threshold), computational complexity, and alternatives like LASSO or recursive feature elimination for larger feature sets.
MediumTechnical
0 practiced
You suspect non-linear relationships between features and target. Describe how to use polynomial features and interaction terms with linear regression, the risks of dimensionality explosion and overfitting, and strategies (regularization, degree selection, feature pruning) to control model complexity.
MediumTechnical
0 practiced
Implement vectorized multiclass cross-entropy loss (softmax + cross-entropy) with L2 regularization in Python/NumPy. Provide multiclass_loss_and_grad(W, X, y_onehot, reg) that returns loss and gradient, include numerical-stability via log-sum-exp, and exclude bias from regularization.

Unlock Full Question Bank

Get access to hundreds of Linear and Logistic Regression Implementation interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.