Variable Types: The Full Taxonomy
Numerical vs categorical variables in full — discrete, continuous, nominal, ordinal, unstructured data — plus the two classification traps that catch everyone.
4. Variable Types — Full Taxonomy
[T]
VARIABLES
|
+---------------------+---------------------+
| |
NUMERICAL CATEGORICAL
(quantitative) (qualitative)
| |
+-----+------+ +----------+--------+---------+
| | | | |
DISCRETE CONTINUOUS NOMINAL BINARY ORDINAL
+ UNSTRUCTURED DATA (not tabular at all)
4.1 Numerical (Quantitative) Variables
General definition: a variable that takes a number — and specifically a quantifiable number, one you can do meaningful arithmetic on.
Discrete
Takes whole numbers only — 1, 2, 3, 4, 5…
Examples given in class:
- Number of cars passing a tollgate every minute — e.g. ~50 vehicles per minute. You cannot have 53.5 cars.
- Number of defective items in a box — you cannot have 5.5 defects.
- Number of items in a shopping cart
Continuous
Can take any value within a range — infinitely divisible.
Examples given in class:
- Amount of rainfall in millimetres (the Chennai rain the night before class)
- Spindle speed in rotations per minute — e.g. 333.3 RPM
- Motor temperature — e.g. 50.3 °C
4.2 Categorical (Qualitative) Variables
Definition: has two or more levels; cannot be quantified. These are qualitative variables.
Simple examples of categorical values: red / orange / yellow · male / female · low / medium / high.
Nominal
Two or more categories with NO order.
Examples given in class:
- Maintenance mode — preventive maintenance / corrective maintenance / predictive maintenance
- Material type — steel / aluminium / composite (which material is used to make a part)
- Product category on Amazon — laptop / washing machine / refrigerator / bed / shoe
- PIN code (see the trap in §5)
Binary
Strictly two categories.
Examples given in class:
- Patient has the disease / does not have the disease
- Customer churn / no churn
- Email spam / non-spam (column name “email type”, values spam or non-spam)
- Pass / fail
- True / false
- Complaint / non-complaint — e.g. whether an application is compliant with government rules
- Good / bad
- Water / non-water
- Cancer / no disease
- Flight delayed / not delayed — predicting whether the flight you’re catching will be delayed
- Email opened / not opened — for an email campaign
- Customer will accept the offer on a call / will not
Business context on the last one: “If you send an email, that is cheaper, that is okay. But if you know whether the customer will accept our offer when you call him — if there’s a possibility he’ll accept, then we’ll call. Otherwise, no. Because talking human to human is very costly.”
This is why binary prediction matters commercially: it lets you allocate expensive resources (human phone calls) only where they’ll pay off.
Ordinal
Categories with a clear order.
Examples given in class:
- Education — primary → secondary school → high school → college
- Signal quality — no signal → weak → fair → good → strong
- Customer service rating — 1 → 2 → 3 → 4 → 5
- Customer satisfaction — low → medium → high
“Ordinal data means there is an order in the data. Low, medium, high — there is an order.”
4.3 Unstructured Data
Definition: data not in tabular format — you cannot store it in rows and columns.
Examples:
- Raw satellite images with no predefined fields
- Images and videos generally
“If your data is not in a tabular format, especially images and videos, we say it is unstructured data. You cannot save them in particular rows and columns.”
5. The Two Classification Traps
[T]
Trap 1 — PIN codes look discrete but are NOT
A PIN code (e.g. 600036, 600042) is written entirely in digits, with no decimal point. It looks exactly like a discrete variable.
The test: can you do meaningful arithmetic on it?
| Cars at a tollgate | PIN code | |
|---|---|---|
| Values | 50 cars, then 52 cars | 600036, 600042 |
| Sum | 102 cars — meaningful | 1200078 — meaningless |
| Average | 51 cars/minute — meaningful | no validity |
| Difference | meaningful | no meaning |
| Verdict | Discrete numerical | Nominal categorical |
Why nominal specifically? Because on top of failing the arithmetic test, PIN codes also have no order among them.
The rule: “If you can do some arithmetic operations, we’ll say discrete. Non-arithmetic, we’ll say categorical.” “Discrete variables are the quantifiable numbers — you can do some mathematics on them.”
Trap 2 — encoded categories look numerical but are NOT
Databases routinely store gender as 1, 1, 0, 0, 0, 1 rather than as text.
“You should not get confused. You should not think that gender is a numerical variable. It is a categorical variable.”
The encoding is a storage convenience. It does not change the nature of the variable.
6. Classification Quiz — Questions & Answers
[T]
Five in-class questions with the instructor’s confirmed answers.
| Q | Item | Answer | Reasoning given |
|---|---|---|---|
| 1 | PIN code | Nominal (categorical) | Looks discrete, but sum/average/difference produce no valid value, and PIN codes have no order |
| 2 | Disease present / not present | Binary | Strictly two categories — “this is present or not” |
| 3 | Customer satisfaction rated low / medium / high | Ordinal | There is a clear order in the data |
| 4 | Number of items in the shopping cart | Discrete numerical | Whole numbers, arithmetic is meaningful |
| 5 | Raw satellite images with no predefined fields | Unstructured data | Cannot be stored in rows and columns |
Note: Q1 was the one that generated the most discussion — a student specifically argued “PIN code is fully numeric without any decimal, it can be discrete also, right?”, which triggered the full explanation in §5.