A4.2.1Significance of data cleaning
0/8
A4.2 Data preprocessingA4.2.1

Significance of data cleaning

Describe the significance of data cleaning

AHL≈ 60 minCommand term: DescribeFree lesson

In this lesson

  • Describing how the quality of training data affects a model's performance
  • Describing techniques for outliers, duplicate, incorrect, irrelevant, improperly formatted and missing data
  • Describing normalisation and standardisation, and when each is preferred

LearnWhy clean data matters

    0 of 4

    LearnProblems and how to treat them

      0 of 6

      LabClean the data, then test the model

      A model predicts house prices from floor area, distance to the centre and age. Treat each problem and watch its error on new sales.

      Raw data: first 12 of 55 rows (price in € thousands)
      IDArea (m²)Distance (km)AgePriceSeller phone
      112711.2623307334419231
      211813.91318907824340488
      3109123317607586784381
      416515.178€263k07721219083
      51623.76831307101024837
      6546.14011400007835788778
      7blank9.13730607110215761
      81607.66730007194892853
      914518.868172,00007456920652
      101881.27034607703847391
      116934515607429572755
      121942.8-5739507157949000
      Duplicate recordsA faulty import sent 3 sales 5 more times each (15 extra rows).
      Improperly formatted dataSome prices were typed as text, such as “€263k” and “172,000”.
      OutliersOne price was typed in euros (×1000) and one floor area has an extra zero.
      Incorrect dataTwo ages are impossible: a negative age, and 999 used to mean “unknown”.
      Missing data4 floor areas are blank (and any values marked as missing).
      Irrelevant dataEach row includes the seller’s phone number.

      Rows used for training: 48 of 55 · Columns: 5 · 3 prices stored as text could not be used.

      Typical prediction error on 200 new, clean sales: €2,733k — the model is useless.

      A price typed in euros (not thousands) and an area with an extra zero are still in the data, and they dominate the model.

      The 15 extra copies give three unusual sales six times their proper weight, pulling the model towards them.

      Treat every problem to complete this activity. For missing data, compare the options: deletion, imputation and prediction all give similar results here. (Predicting a missing area from the price works only for training data: a new house’s price is what the model must predict.)

      LearnNormalisation and standardisation

      Features measured in different units have very different ranges. Many algorithms (k-NN, clustering, gradient descent) are affected by those ranges, and the result would even change if a feature were recorded in different units (metres instead of kilometres). So features are rescaled first.

        0 of 3

        LabDoes scaling matter?

        A k-nearest-neighbours model sorts houses into above or below the median price, using floor area (m²) and distance to the centre (m).

        Featureminmaxmeanstandard deviation
        Floor area50.0019712339.65
        Distance1,20019,90010,5665,377

        k-NN accuracy (each house classified from its 3 most similar houses): 59%

        Distances in metres run into the thousands while floor areas are in the hundreds, so “similar” houses are chosen almost only by distance; floor area, the most important feature, is nearly ignored.

        Try all three options, and both scaling methods with the extreme value, to complete this activity.

        CheckQuick check

        A feature has the values 20, 50 and 80. What is 50 after min-max normalisation to the range 0–1?

        ExamWorked exam answer

        A gym's attendance data contains each visit twice for members who used both the front and side doors. Describe how these duplicate records could affect a model that predicts busy times, and how they should be treated.

        [2]
          Try writing your own answer first.

          ReviewMistakes examiners see

          Misconception

          Removing every outlier automatically. A rare but real value (a very expensive house) is information; only errors should be removed.

          Misconception

          Mixing up the two scalings: normalisation sets a fixed range (0 to 1); standardisation sets mean 0 and standard deviation 1.

          Exam tip

          For “Describe” questions, name the technique, say what it does to the data, and give its effect on the model in the scenario.

          Exam practiceExam-style questions

          4 questions · 12 marks. Answer each one first, then mark it yourself against the markscheme. Your answers are saved in this browser only.

          Scenario

          A cycling app predicts how long a ride will take from its distance (km), total climb (m) and the weather. It trains on rides recorded by thousands of users' phones. Some rides have no climb recorded, and a few phones recorded impossible speeds.

          (a)Describe · AO2[3]

          A few rides show average speeds of over 200 km/h because of GPS errors. Describe how these outliers could be identified and treated.

          (b)Describe · AO2[4]

          Describe two ways of dealing with the rides that have no climb recorded.

          (c)Explain · AO3[3]

          The model uses k-nearest neighbours. Distances range from 1 to 150 km and climbs from 0 to 3000 m, and a few rides cross high mountain passes. Explain why the features should be scaled, and why standardisation may be preferred to normalisation here.

          (d)Describe · AO2[2]

          Almost all of the app's users are experienced cyclists. Describe how this could affect the model's predictions.

          0 / 12

          0 of 4 questions marked. Mark every question to see your total.

          Exam-style questions written for Praxis IB in the format of the 2027 specimen papers. They are not IB past-paper questions.