AI Foundations ← pitcsolutions.com All lessons

Lesson 2 of 13 in Start here, about 12 minutes

Types of Machine Learning

Machines can learn with answers, without answers, with a few answers, or by trial and error. Here is how each works.

By the end of this lesson you will be able to

  • name the four main ways a machine can learn from data
  • tell which type fits a given problem by looking at the data you have
  • connect each type to everyday products and AWS services

In Machine Learning, learning means the way a model picks up patterns from data. What decides the type of learning is simple: what kind of data do you give the model, and what feedback does it get?

Four panels. Supervised: coloured points with a fitted line. Unsupervised: grey points forming two clusters. Semi-supervised: a few coloured points among many grey ones. Reinforcement: an agent acts on an environment and receives a reward. Supervised every example has an answer Unsupervised no answers, find the groups Semi-supervised a few answers, lots without Reinforcement Agent World action reward orpenalty learn by trial and error
The four types at a glance. Colour means “this example has a label (a correct answer)”. Grey means “no label”.
TypeData requiredGoalReal-life examplesAWS services
SupervisedLabelled data (input + correct output)Predict the correct outputSpam detection, house price prediction, disease diagnosisSageMaker AI, Rekognition, Comprehend
UnsupervisedUnlabelled dataFind hidden patterns or groupsCustomer segmentation, fraud detection, market basket analysisSageMaker AI
Semi-supervisedA little labelled data + a lot of unlabelled dataImprove accuracy with limited labelsMedical image classification, speech recognition, document classificationSageMaker AI
ReinforcementRewards and penaltiesLearn the best actions by trial and errorSelf-driving cars, robot navigation, chess and Go, recommendation optimisationSageMaker AI (RL toolkit)

1. Supervised learning

The model learns from labelled data: every example comes with the correct answer.

Input→Model→Correct output

Suppose we teach a model with three houses whose prices we already know:

Input: house sizeOutput: price
1000 sq ft₹40 lakh
1500 sq ft₹60 lakh
2000 sq ft₹80 lakh

The model notices the pattern (about ₹4,000 per square foot). Now, for a house it has never seen, like 1800 sq ft, it predicts ≈ ₹72 lakh.

Try it: be the model

Drag the slider to choose a new house size. The dashed line is the pattern learned from the three labelled examples.

Where you see it: spam email detection, face recognition, loan approval, weather prediction, disease diagnosis.

2. Unsupervised learning

The model receives only inputs, no answers, and discovers hidden structure by itself.

Input→Model→Groups / patterns

Suppose you own a supermarket and have this customer data, with no labels at all:

CustomerAgeIncome
A22Low
B24Low
C45High
D47High

Nobody told the algorithm what the groups are, yet it automatically finds two: young, lower-income customers (A, B) and middle-aged, higher-income customers (C, D). The shop can now design different offers for each group.

Where you see it: customer segmentation, recommendation systems, market basket analysis, fraud and anomaly detection.

3. Semi-supervised learning

Only a small part of the data is labelled. The model learns from both parts.

10% labelled+90% unlabelled→One model

A hospital has 10,000 X-rays, but doctors have only had time to label 100 of them as “cancer” or “no cancer”. Labelling all 10,000 by hand would take months. Instead, the algorithm learns from the 100 labelled images, uses that knowledge to infer labels for the other 9,900, and learns from those too.

Where you see it: medical imaging, speech recognition, OCR, image classification. Anywhere labels are expensive but raw data is plentiful.

4. Reinforcement learning (RL)

The model learns by interacting with an environment and receiving rewards or penalties.

Action→Reward or penalty→Better next action

Attempt 1

The robot tries to walk… and falls. Penalty.

Attempt 2

The robot walks more carefully… and moves forward. Reward.

After thousands of attempts, the robot discovers the best walking strategy. Nobody gave it the “correct” movement; it found it through trial and error.

Where you see it: self-driving cars, robotics, game-playing AI, trading strategies, recommendation systems that adapt as you click. It is also how chatbots like ChatGPT are fine-tuned to be helpful (you will meet this as RLHF in lesson 10).

Quick comparison

FeatureSupervisedUnsupervisedSemi-supervisedReinforcement
Labelled data✅ Yes❌ No⚠️ Partial❌ No
Learns fromCorrect answersHidden patternsLabelled + unlabelled dataRewards and penalties
Main goalPredictionGrouping, pattern discoveryBetter prediction with fewer labelsBest decision-making
OutputA class or a valueClusters, associationsA class or a valueAn optimal action (policy)
ExampleSpam detectionCustomer segmentationMedical diagnosisSelf-driving car
The classroom analogy

Supervised: you give students questions with the correct answers; they learn by comparing.
Unsupervised: you give students a box of mixed objects and ask them to group similar items, with no instructions.
Semi-supervised: you solve a few examples on the board, then students solve many similar problems on their own.
Reinforcement: students gain marks for right answers and lose marks for mistakes; over time they learn the strategy that scores highest.

Try it: which type is it?

(a) Grouping news articles into topics nobody has defined. (b) Predicting tomorrow's temperature from 10 years of records. (c) Teaching a drone to land using a points system.

Show answers

(a) Unsupervised. (b) Supervised: past records have the “answer” (the actual temperature). (c) Reinforcement.

Key takeaways

  • Look at the data first: labels → supervised; no labels → unsupervised; a few labels → semi-supervised; rewards → reinforcement.
  • Supervised learning predicts; unsupervised learning discovers; reinforcement learning decides.
  • Semi-supervised learning is a practical middle ground when labelling is expensive.

Check your understanding

1. A bank has millions of transactions but no labels, and wants to find unusual ones. Which type fits best?

Without labels, the model looks for transactions that don't fit the normal patterns: anomaly detection, an unsupervised task.

2. What makes reinforcement learning different from the other three?

RL learns by acting in an environment and receiving feedback, rather than from a fixed dataset of examples.

3. Why use semi-supervised learning?

It squeezes more value out of a small labelled set by also learning from plentiful unlabelled data.