aımnova
DashboardMy LearningCrash CoursesStudy Plan

Aimnova site navigation

Stay in the loop

Get the latest study resources and updates

New features, study tips and exam insights — straight to your inbox.

IB Diploma

  • IB Past Papers
  • IB Study Notes
  • IB Question Bank
  • IB Mock Exams
  • IB Revision

IB Subjects

  • IB Math AA
  • IB Math AI
  • IB Economics
  • IB Business Management
  • IB Physics
  • IB Biology
  • View all IB subjects→

IB Past Papers

  • IB Math AA HL Past Papers
  • IB Math AA SL Past Papers
  • IB Math AI HL Past Papers
  • IB Math AI SL Past Papers
  • IB Economics HL Past Papers
  • IB Economics SL Past Papers
  • IB ESS Past Papers
  • View all past papers→

Study Resources

  • Study Notes
  • Question Bank
  • Mock Exams
  • Crash Courses
  • Flashcards
  • Revision Guide
  • Exam Skills
  • Command Terms
  • Grade Calculator
  • Exam Timetable 2026

Aimnova

  • Features
  • Pricing
  • For Teachers
  • For Schools
  • For Parents
  • About Us
  • Blog
  • Contact
aımnova

IB study, practice and feedback built around the real exam.

TermsPrivacyCookies·© 2026 Aimnova. All rights reserved.c1e448f

Aimnova is not affiliated with or endorsed by the International Baccalaureate Organization (IB).

NotesComputer Science HLTopic 4.3Clustering
Back to Computer Science HL Topics
4.3.44 min read

Clustering (Computer Science HL)

IB Computer Science · Unit 4

IB exam ready

Study like the top scorers do

Access a smart study planner, AI tutor, and exam vault — everything you need to hit your target grade.

Start Free

Contents

  1. 1Finding groups nobody defined
  2. 2k-means, step by step
  3. 3Choosing k, and reading the result
  4. 4Exam-style question
The big idea: Clustering groups records that resemble each other, with no labels and no idea in advance of what the groups should be.

The groups are the output, not the input. That is what makes it unsupervised.
ClassificationClustering
LearningSupervisedUnsupervised
NeedsLabelled examplesNo labels at all
Groups areKnown in advanceDiscovered
QuestionWhich known category is this?What groups exist here?
Evaluated byComparing with the true answerJudgement — there is no true answer

Free preview

This is the free notes preview

You're reading the free notes. Aimnova Pro unlocks the full study experience — and you can try it with your first topic free to keep:

  • FlashcardsLock in vocabulary and key terms with spaced repetition.
  • Practice questionsAnswer exam-style questions and get instant AI marking.
  • Mock exams & past-paper vaultSit full mocks and see exactly how examiners award marks.
  • Personalised study planA daily plan built around your exam date and weak areas.
Start Studying Free Full access to Aimnova Pro · cancel anytime
1

Choose k and place centres (centroids)

You decide how many clusters to look for. k is a hyperparameter — the algorithm cannot work it out. Start with k centres placed at random.

2

Assign

Every point joins the cluster whose centre is nearest.

3

Move the centres

Each centre moves to the mean position of the points now assigned to it.

4

Repeat until stable

Reassign and move again until nothing changes. The result is a set of clusters — and the algorithm never knows what any of them means.

The starting positions change the answer: Different random starts can give different final clusters from the same data. k-means finds a local optimum, not the best possible grouping.

Standard practice is to run it several times and keep the best — which is an admission that one run cannot be trusted.

Memorize terms 3x faster

Smart flashcards show you cards right before you forget them. Perfect for definitions and key concepts.

Try Flashcards FreeYour first topic is free to keep • No credit card required

Deciding how many clusters

  • The elbow method — plot total within-cluster distance against k and look for where it stops falling sharply
  • Beyond that point, extra clusters split groups that were already coherent
  • Domain knowledge often beats the plot: a shop may want four segments because it can run four campaigns
  • k = n gives a perfect score and no information, which shows the measure alone cannot choose
The clusters have no names: The algorithm returns "cluster 0, 1, 2". Deciding that cluster 1 is "price-sensitive weekly shoppers" is a human interpretation of the records inside it.

That interpretation can be wrong, and nothing in the output will say so.
Scale the features first: k-means uses distance, so a feature measured in thousands dominates one measured in units. Income in pounds against number of children will cluster almost entirely on income.

Normalising first is not a detail — without it the result is decided by whichever column happens to have big numbers.

How this is tested — you must identify a task as unsupervised, trace k-means, and be honest about what the output does not tell you. It comes up two ways:

Paper 1 Section A

  • Describe how clustering groups data, 3-4 marks
  • Identify a task as supervised or unsupervised
  • State one step of k-means

Paper 1 Section B — case study

  • Justify clustering for a scenario
  • Explain a limitation of the result
The classic trap: Saying the algorithm "finds customer types". It finds groups of similar records. Calling one of them a customer type is a human reading, and it can be wrong.
IB-style questionDescribe[5 marks]

A supermarket wants to group customers by shopping habits without deciding the groups in advance. Describe how k-means would do this and state two limitations.

Model answer plan

See the answer broken into clear points, with guidance on how each point earns marks.

Claim your free topic

Try an IB Exam Question — Free AI Feedback

Test yourself on Clustering. Write your answer and get instant AI feedback — just like a real IB examiner.

why clustering is an unsupervised learning technique. [2 marks]

Related Computer Science HL Topics

Continue learning with these related topics from the same unit:

4.1.1Types of machine learning4.1.2Hardware for machine learning4.2.1Data cleaning4.2.2Feature selection
View all Computer Science HL topics
Improve your exam techniqueCommand terms, paper structure, and mark-scheme tips for Computer Science HL
Previous4.3.3Hyperparameter tuningNextAssociation rules4.3.5

3 practice questions on Clustering

Students who practiced this topic on Aimnova scored 82% on average. Try free practice questions and get instant AI feedback.

Try 3 Free QuestionsView All Computer Science HL Topics