Sonzaschool
Rudi

Sekondari ya Kawaida · Kidato cha Nne · Amali · Electronics and Computer

Computer Programming

Performing basic data normalisation and standardisation

takriban dakika 5 kusoma

Majadiliano
Mada za sehemu hiiCleaning and organising dataMada 4

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

Jinsi utakavyotathminiwaTathmini ya mchakato · Tathmini ya matokeo · Tathmini ya maarifa

Tathmini ya mchakato

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

Tathmini ya matokeo

A preprocessed dataset with numerical features normalized or standardized.

Tathmini ya maarifa

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).

Swali

What is the output range of min-max normalization?

Ingia ili kuwasilisha jibu lako na lihesabiwe katika umahiri wako.

Ingia ili kufanya mazoezi

Mwalimu

Umekwama? Niulize chochote kuhusu mada hii.

Ingia ili kumuuliza Mwalimu wa AI wa Sonza kuhusu swali hili.

Ingia ili kuuliza

Majadiliano

Hakuna maswali bado

Ingia ili kuuliza
Inapakia majadiliano…