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.3Linear regression
Back to Computer Science HL Topics
4.3.15 min read

Linear regression (Computer Science HL)

IB Computer Science · Unit 4

AI-powered feedback

Stop guessing — know where you lost marks

Get instant, examiner-style feedback on every answer. See exactly how to improve and what the markscheme expects.

Try It Free

Contents

  1. 1A line through the data
  2. 2How the line is chosen
  3. 3When it works and when it does not
  4. 4Exam-style question
The big idea: Linear regression predicts a continuous number by fitting a straight line through the data.

The model is just — and training means finding the and that make the line fit best.

What makes it regression rather than classification

  • The output is a number on a scale — price, temperature, minutes, marks
  • Not a category — spam or not, cat or dog, pass or fail
  • "How much?" is regression · "which one?" is classification
  • The same input data can support either, depending on what you ask

The words the guide uses

TermMeaningHouse-price example
Independent (predictor) variable, xThe input used to make the predictionFloor area in m²
Dependent (response) variable, yThe continuous value being predictedPrice
Slope, mHow much y changes when x goes up by 1Price per extra m²
Intercept, cThe value of y when x is 0: where the line crosses the y-axisOften has no real meaning (a 0 m² house)
r²How well the line fits: the share of the variation in y the model explains, from 0 (none) to 1 (all)r² = 0.85: the line explains 85% of the variation in price

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

Measure the error

For each point, the residual is the gap between the real value and the line's prediction.

2

Square it

Squaring makes every error positive, so errors above and below cannot cancel out — and it punishes large errors much more than small ones.

3

Minimise the total

The best line is the one with the smallest sum of squared residuals. This is why the method is called least squares.

4

Read off the parameters

The resulting m (gradient) says how much y changes per unit of x; c (intercept) is the prediction when x is zero.

The gradient is the interpretation: In a model predicting house price from floor area, m is the price per square metre.

That is why regression is prized where a decision has to be explained: the parameter itself is a plain-English statement about the world.
Squaring is why outliers hurt: An error of 10 contributes 100; an error of 100 contributes 10,000. One wildly wrong point can drag the whole line towards itself, which is why outliers matter so much more here than in some other methods.

Practice with exam-style questions

Answer exam-style questions and get AI feedback that shows you exactly what examiners want to see in a full-marks response.

Try Practice FreeYour first topic is free to keep • No credit card required
WorksFails
RelationshipRoughly straightCurved, or a threshold effect
OutputContinuousCategories
OutliersFewAny — squaring amplifies them
ExtrapolationInside the observed rangeOutside it — the line keeps going, reality may not
Extrapolation is the classic failure: A line fitted to house sizes between 50 and 200 m² will happily predict a price for 5,000 m², or a negative price for 0 m².

The model has no concept of the range it was trained on. Predicting outside it is the commonest way regression gives an absurd answer with full confidence.
Correlation is not causation: A regression showing ice-cream sales predicting drownings has found a real correlation with a third cause — hot weather. The model is not wrong; the causal reading of it is.

How this is tested — you must decide whether the target is continuous, interpret the gradient, and know where the line stops being trustworthy. It comes up two ways:

Paper 1 Section A

  • Explain how linear regression predicts, 3-4 marks
  • Identify whether a task is regression or classification
  • State what the gradient means

Paper 1 Section B — case study

  • Interpret a fitted model in context
  • Explain why a prediction is unsafe
The classic trap: Reading a gradient as a cause. Regression finds that two things move together; it says nothing about one producing the other. Say "associated with", not "causes".
IB-style questionExplain[5 marks]

An estate agent fits price = 2400 × area + 18000, using homes between 50 and 200 m². Explain what the model says, and why its prediction for a 600 m² property should not be trusted.

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 Linear regression. Write your answer and get instant AI feedback — just like a real IB examiner.

A regression model predicting the time a delivery takes from its distance has r2 = 0.9. what this value shows. [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.2.3Dimensionality reductionNextClassification4.3.2

3 questions to test your understanding

Reading is just the start. Students who tested themselves scored 82% on average — try IB-style questions with AI feedback.

Start FreeView All Computer Science HL Topics