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. What is the difference between classification and regression?

    Classification predicts a category (spam or not spam, pass or fail). Regression predicts a continuous number (a house price, tomorrow's temperature). The choice depends on the type of the target column, not on the algorithm.

    BeginnerQuick answer1 min read
  3. How does a decision tree predict a number in regression?

    It splits the data to reduce squared error and each leaf predicts the average target of the rows in it. The output is therefore piecewise constant, a staircase, not a smooth line.

    IntermediateQuick answer1 min read
  4. Why can't a random forest or decision tree extrapolate beyond the training range?

    Tree leaves hold averages of training targets, so a prediction can never exceed the largest or fall below the smallest value seen in training. For trends that continue upward, such as sales growth, linear models or feature engineering work better.

    AdvancedQuick answer1 min read