2.1.1 · D1Data Preprocessing & Feature Engineering

Foundations — Types of data (numerical, categorical, ordinal, text)

2,013 words9 min readBack to topic

The parent note throws around , , , , summation signs, Euclidean distance, and words like "variance" and "one-hot vector". If you have never met these, the derivations look like spells. This page builds every one of them from nothing, in the order they stack.


0. What is "data" in the first place?

Figure — Types of data (numerical, categorical, ordinal, text)

Look at the figure. The whole topic lives inside a single question you ask column by column: what kind of property is this? The red column is the one we are inspecting. There are only three honest answers — number, name, or ranked-name — and the rest of this page defines the tools each answer needs.


1. Numbers, the number line, and

The picture of a real number is a dot on a horizontal ruler. "Continuous" data (height ) can land anywhere on the ruler. "Discrete" data (clicks ) can only land on the evenly-spaced integer ticks.


2. The index and the summation sign

The parent writes . Three symbols hide here.

The picture of is a conveyor belt: items roll past and drop into one bucket that keeps a running total.


3. The mean — the balance point

Figure — Types of data (numerical, categorical, ordinal, text)

The picture is a seesaw. Drop each data value as a weight on the number line; is the exact spot where the plank balances. Values far to the right pull the balance point right; that is why one huge house price drags the mean up.


4. Spread, variance, and the standard deviation

Knowing the balance point is not enough — two datasets can share a mean but one is tightly bunched and the other wildly spread. We need a number for spread.

Why not just average the deviations? Because the left pulls (negative) and right pulls (positive) cancel to exactly zero — that is literally what "balance point" means. So we square each deviation first (a negative squared becomes positive), average those, then take the square root to undo the squaring.

Figure — Types of data (numerical, categorical, ordinal, text)

The red band in the figure spans to — the "usual" zone. The square-then-root trick is why is measured in the same units as the data (rupees, cm), unlike raw variance (rupees-squared).


5. Vectors, , and the basis arrow

Categorical encoding lands us in the notation . Let's earn it.

Figure — Types of data (numerical, categorical, ordinal, text)

The figure shows and . The red arrow is a chosen category living purely along its own axis, touching no other. That is exactly the promise of one-hot encoding: give each category its own private direction so the machine never thinks one category is "between" two others.


6. Distance — why keeps appearing

The parent claims every two one-hot vectors sit apart. Here is the tool behind that.


7. Order vs no-order: the symbol

The three data types differ exactly in whether is meaningful:

Type Is meaningful? Is the gap size meaningful?
Numerical Yes Yes ( really is )
Ordinal Yes (PhD Master's) No (gaps uneven)
Categorical No (Red vs Blue has no order) No

Prerequisite map

Dataset as a table

Real number and number line

Index i and summation sign

Mean mu balance point

Deviation and standard deviation sigma

Vector and space R to the k

Basis arrow e i

Euclidean distance

Order relation less than

Numerical scaling

Categorical one hot

Ordinal encoding

Types of Data topic


Equipment checklist

Cover the right side and check you can say each aloud.

What does mean in plain words?
" is some point on the infinite number line."
What does instruct you to do?
Add up every value from the 1st to the -th.
What is and what picture matches it?
The mean — the balance point of the data weights on the number line.
Why square the deviations before averaging in ?
Raw deviations cancel to zero; squaring removes signs so spread survives.
Can ever be negative?
No — it is a distance, always .
What is ?
The set of all length- lists of real numbers — -dimensional arrows.
What is the vector ?
All zeros except a single in position — one pure axis direction.
Why are any two one-hot vectors apart?
They differ by a and a gap, giving .
Which data type allows but not equal spacing?
Ordinal.
Which data type forbids entirely?
Categorical.

Return to the parent topic once every checklist line answers itself instantly.