liveBook · Manning

Nominal data

As explained in Ensemble Methods for Machine Learning

A nominal feature is a categorical feature whose categories have no inherent ordering or quantitative relationship.

A nominal feature groups examples into named categories without ranking them. In a T-shirt price task, color is nominal: red, blue, and green are simply different labels, while size is ordinal because S < M < L < XL. section 8.1.1

Machine-learning models usually need categorical values converted into numbers. Assigning integers to nominal categories is arbitrary and can falsely suggest an order, so encoding requires attention to both the feature’s meaning and the model’s interpretation. section 8.1.2

Distinguish nominal data from related encoding choices:

  • Nominal categories have no inherent ordering; ordinal categories do. section 8.1.1
  • Ordinal encoding assigns integer labels, but those numbers impose an ordering even when categories are nominal. section 8.1.2
  • One-hot encoding creates binary columns for categories, avoiding a sequential numeric label for each nominal value. section 8.1.2 section 8.5

Encoding T-shirt attributes

For color values red, green, and blue, OneHotEncoder produces three binary columns; a separate four-column representation can encode sizes XL, L, M, and S. The resulting rows contain indicators such as [1, 0, 0] for red rather than an ordered color score. section 8.1.2

Figure 8.1 T-shirts in this example data set are described using two categorical features: color and size. Categorical features can be either (1) nominal, where there is no ordering between the various categories, or (2) ordinal, where there is an ordering between the categories. The third feature in this data set, cost, is a continuous, numeric variable.
CH08_F01_Kunapuli

Compare nominal color, ordinal size, and continuous cost in the T-shirt feature diagram. section 8.1.1

How Ensemble Methods for Machine Learning covers it

How deep it goes
Defines the category relationship, contrasts ordinal data, and connects encoding choice to ordering and interpretability.
Examples
Uses T-shirt colors and sizes, plus scikit-learn encoder configurations and binary output arrays.
What it assumes
Assumes familiarity with features and machine-learning models while reinforcing categorical and continuous data distinctions.
What you can do after
Apply via scikit-learn by distinguishing unordered categories from ordered ones and choosing a corresponding encoding.
How it connects
Connects categorical features with ordinal features, feature engineering, ordinal encoding, and one-hot encoding.

Also explained in

Compare how 4 books explain nominal data →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Ensemble Methods for Machine Learning. The section links point to the parts of the book it draws on.