AI Hints
Statistics & Math for ML · Lesson 3 of 138

Types of Data

Numbers and categories.

⏱ 2 min read▶ Video at 2:19🎓 Free
Watch this lesson in the Statistics & Math for ML courseWatch on YouTube ↗Full Statistics & Math for ML course

Not every column is a number you can add up. A score of ninety is a number. But a city, like London, is a category. Knowing which type you have tells you which statistics make sense.

Types of Data
From the video: Types of Data
  • Not every column is a number
  • Numbers and categories
  • Type decides the maths

The main types

Numerical data is measured with numbers. Continuous numbers can take any value, like height. Discrete numbers are counts, like number of children. Categorical data puts things into groups. Nominal categories have no order, like colours. Ordinal categories do, like small, medium, and large.

TypeExampleCan you average it?
Continuousheight: 171.4 cmyes
Discretechildren: 2yes
Nominalcity: Londonno, count it
Ordinalsize: S, M, Lorder, not average

Why it matters for ML

Models only understand numbers. So categories have to be turned into numbers first. But be careful. If you code red as one, green as two, and blue as three, the model thinks blue is three times red. Instead, we usually make one yes or no column for each category. That's called one hot encoding.

keyvalue
Models neednumbers
Bad ideared=1, green=2, blue=3
Betterone column per category
Nameone-hot encoding

Summary

Data is numerical, either continuous or discrete, or categorical, either nominal or ordinal. The type decides what you can compute. Next, populations and samples.

Key takeaways
  • Continuous and discrete
  • Nominal and ordinal
  • One-hot for categories
Next up: Populations and Samples — the part and the whole