Types of Machine Learning — ML Technical Interview Questions & Answers

Supervised, unsupervised, semi-supervised and reinforcement learning.

Types of Machine Learning

  • Simple meaning: Four buckets. Supervised — the sheet has the answer (marks, pass/fail). Unsupervised — no answer column; you only group similar rows. Reinforcement — try an action, get a reward (game, robot). Semi-supervised — a few labelled rows, lots of unlabelled ones.
  • Picture: Supervised = “these emails are spam / not spam”. Unsupervised = “here are 1000 students, find natural groups”. RL = “move the paddle, score goes up”. Most college projects are supervised.
  • Inside supervised: regression predicts a number (marks, price). Classification predicts a label (pass/fail, spam/ham).
  • Trap: calling k-means supervised. Trap: saying deep learning is a fourth type — it is a technique, often still supervised.
  labelled y? ──yes──► supervised (number or class)
       │ no
       ▼
  unsupervised (groups / compress)

Technical Interview Tip: Labels? Supervised. No labels? Unsupervised. Rewards? RL.

Code Examples for Types of Machine Learning

Types of Machine Learning — working example

# Supervised idea: learn y from X
X = [[1], [2], [3], [4]]
y = [2, 4, 6, 8]  # roughly y = 2x

def predict(x, w=2.0):
    return w * x

preds = [predict(row[0]) for row in X]
mse = sum((yt - yp) ** 2 for yt, yp in zip(y, preds)) / len(y)
print(preds, mse)

Types of Machine Learning — mL learns patterns from data. Start with features X, labels y, a model, and a metric like MSE/accuracy.

How to Explain Types of Machine Learning to an Interviewer

Supervised vs unsupervised?

Labels vs no labels Predict y vs find groups

Regression or classification?

Number vs class name