Interview Q&A / Machine Learning

INTERVIEW Q&A · 55 QUESTIONS

Machine Learning interview questions

Supervised vs unsupervised learning, overfitting, metrics and the classic models, explained simply.

  1. What is the difference between linear regression and logistic regression?

    Linear regression predicts a continuous number, like a house price, by fitting a straight line. Logistic regression predicts the probability of a class, like spam or not spam, by passing a linear score through the sigmoid function so the output stays between 0 and 1.

    BeginnerIn-depth4 min read
  2. Fit a line to the points (1,2), (2,4), (3,5) and compute R squared.

    Slope = 1.5, intercept = 0.667, so y = 0.667 + 1.5x. R squared = 1 - 0.1667/4.6667, about 0.964: the line explains about 96% of the variation in y.

    IntermediateQuick answer1 min read
  3. What are the main assumptions of linear regression?

    Linearity between features and target, independent errors, constant error variance (homoscedasticity), roughly normal errors (needed mainly for confidence intervals), and no severe multicollinearity among features.

    IntermediateQuick answer1 min read
  4. What is multicollinearity, and how do you detect and fix it?

    Multicollinearity means two or more features are strongly correlated, so a linear model cannot tell their effects apart and coefficients become unstable. Detect it with a correlation matrix or VIF above about 5-10. Fix it by dropping or combining features, PCA, or ridge regression.

    IntermediateQuick answer1 min read