Data is simply a collection of measurements in the form of numbers, words, measurements, observations, descriptions of things, images, and so on.
The most common way to represent the data is using a set of attribute-value pairs. Consider the following example:
Bob = { height: 185cm, eye color: blue, hobbies: climbing, sky diving }
For example, Bob
has attributes named height
, eye color
, and hobbies
with values 185cm
, blue
, climbing
, sky diving
, respectively.
A set of data can be simply presented as a table, where columns correspond to attributes or features and rows correspond to particular data examples or instances. In supervised machine learning, the attribute whose value we want to predict the outcome, Y, from the values of the other attributes, X, is denoted as class or the target variable, as follows:
Name |
Height [cm] |
Eye color |
Hobbies |
---|---|---|---|
Bob |
185.0 |
Blue |
Climbing, sky diving |
Anna |
163.0 |
Brown |
Reading |
… |
… |
… |
… |
The first thing we notice is how varying the attribute values are. For instance, height is a number, eye color is text, and hobbies are a list. To gain a better understanding of the value types, let's take a closer look at the different types of data or measurement scales. Stevens (1946) defined the following four scales with increasingly more expressive properties:
Why should we care about measurement scales? Well, machine learning heavily depends on the statistical properties of the data; hence, we should be aware of the limitations each data type possesses. Some machine learning algorithms can only be applied to a subset of measurement scales.
The following table summarizes the main operations and statistics properties for each of the measurement types:
Property |
Nominal |
Ordinal |
Interval |
Ratio |
---|---|---|---|---|
Frequency of distribution |
✓ |
✓ |
✓ |
✓ |
Mode and median |
✓ |
✓ |
✓ | |
Order of values is known |
✓ |
✓ |
✓ | |
Can quantify difference between each value |
✓ |
✓ | ||
Can add or subtract values |
✓ |
✓ | ||
Can multiply and divide values |
✓ | |||
Has true zero |
✓ |
Furthermore, nominal and ordinal data correspond to discrete values, while interval and ratio data can correspond to continuous values as well. In supervised learning, the measurement scale of the attribute values that we want to predict dictates the kind of machine algorithm that can be used. For instance, predicting discrete values from a limited list is called classification and can be achieved using decision trees; while predicting continuous values is called regression, which can be achieved using model trees.