Sonzaschool
Back

O-Level · Form 4 · Vocational · Electronics and Computer

Computer Programming

Performing basic data normalisation and standardisation

about 5 minutes to read

Discussions
Topics in this sectionCleaning and organising data4 topics

When working with real-world data, different features often have very different ranges. For example, a dataset about small businesses in Tanzania might have "monthly profit" measured in tens of thousands of shillings and "years in operation" measured in single digits. Many machine learning algorithms work much better when all features are on a similar scale. This process of adjusting data to a common range is called scaling, and the two most common approaches are normalization and standardization.

Normalization scales data to a specific range, usually between 0 and 1. The most common method is min-max scaling, which uses the minimum and maximum values of the data.

The formula for min-max normalization is:

xnormalized=x−xminxmax−xminx_{normalized} = \frac{x - x_{min}}{x_{max} - x_{min}}

Where:

  • xx is the original value
  • xminx_{min} is the smallest value in the feature
  • xmaxx_{max} is the largest value in the feature

After this transformation, the smallest value becomes 0 and the largest becomes 1. All other values fall between 0 and 1.

Worked Example

Suppose a Tanzanian farmer recorded tomato sales over five days:

DayTomatoes Sold
120
235
315
450
540

Using min-max normalization:

  • xmin=15x_{min} = 15
  • xmax=50x_{max} = 50

For Day 1 (20 tomatoes): xnormalized=20−1550−15=535=0.14x_{normalized} = \frac{20 - 15}{50 - 15} = \frac{5}{35} = 0.14

For Day 3 (15 tomatoes): xnormalized=15−1550−15=0x_{normalized} = \frac{15 - 15}{50 - 15} = 0

For Day 4 (50 tomatoes): xnormalized=50−1550−15=1x_{normalized} = \frac{50 - 15}{50 - 15} = 1

The normalized values are: 0.14, 0.57, 0, 1, 0.71

How you'll be assessedProcess assessment · Outcome assessment · Knowledge assessment

Process assessment

  • Scale numerical data effectively.
  • Apply normalization or standardization based on context.

Outcome assessment

A preprocessed dataset with numerical features normalized or standardized.

Knowledge assessment

Detailed knowledge of:

Method used: The student should explain how to:

  • normalize data using Python
  • standardize data using Python.

Principles: The student should explain the principles of

  • Reducing feature bias in data analysis.

Theories: The student should explain:

  • Normalization versus standardization (e.g., min-max scaling vs. z-score).

Circumstantial knowledge:

Detailed knowledge about:

  • Deciding when scaling is necessary (e.g., for algorithms sensitive to data ranges).

Question

What is the output range of min-max normalization?

Sign in to submit your answer and have it count toward your mastery.

Sign in to practice

Tutor

Stuck? Ask me anything about this topic.

Sign in to ask the Sonza AI Tutor about this question.

Sign in to ask

Discussions

No questions yet

Sign in to ask
Loading discussions…