Metric Learning for Categorical and Nominal Data

You are reading version 1 of this direction, frozen 2026-10-04. The latest version is version 2.

Version 1 of 287 papers95 conceptsfrozen 2026-10-04

In machine learning, we often take the concept of "distance" for granted. If you have two data points representing height and weight, you can calculate the Euclidean distance between them. You can find their average. You can determine that 180cm is closer to 175cm than it is to 100cm.

But how do you calculate the distance between "Doctor" and "Lawyer"? Or "Red" and "Blue"?

This is the fundamental challenge of categorical (or nominal) data. Unlike numerical data, categories lack an inherent mathematical order or a geometric center. As noted in Categorical data clustering: 25 years beyond K-modes by Duy-Tai Dinh and colleagues, the primary hurdle in analyzing this data isn't the clustering logic itself, but the definition of a meaningful similarity metric. Without a "natural ruler," standard algorithms like K-means or Gaussian Processes simply break down.

The Failure of Simple Matching

The most common fallback for categorical data is "simple matching": if two values are the same, the distance is 0; if they are different, the distance is 1.

However, as Taixi Chen and Yiu-ming Cheung argue in CADM, this binary approach is too blunt. It treats "Professional" and "Self-employed" as being just as different as "Professional" and "Unemployed." This loss of nuance prevents models from capturing the underlying relationships between discrete concepts. To solve this, researchers have moved toward "learning" the distance rather than assuming it.

Discovering Latent Orders

One intuitive way to fix categorical data is to turn it into numerical data by finding an "optimal order." Even if categories don't have a natural sequence, they often have an implicit one based on how they relate to other variables.

In Order and Cluster Learning (OCL), Mingjie Zhao and Yiu-Ming Cheung propose mapping categorical values onto a one-dimensional numerical line. By jointly optimizing the order of these values and the cluster assignments, the model discovers a linear arrangement that makes the data "behave" like numerical data. This allows researchers to use standard distance-based tools while making the relationships between categories (like occupations or hobbies) human-interpretable.

Embedding into Continuous Spaces

Beyond simple ordering, a more powerful approach involves embedding categories into high-dimensional continuous spaces. The goal is to represent each category as a vector where the geometric distance between vectors reflects their semantic or statistical similarity.

  • Graph Diffusion: Lei Gu introduced TAVE (Attribute Value Embedding), which uses graph diffusion to capture complex, transitive relationships between attributes. If "Doctor" and "Hospital" frequently appear together, and "Hospital" and "Nurse" do too, TAVE can infer a proximity between "Doctor" and "Nurse" even if they never appear in the same record.
  • Latent Variables: For Gaussian Processes, which are the backbone of Bayesian Optimization, Liping Wang and Sayan Ghosh developed Latent Variable Gaussian Processes (LVGP). This method maps categorical sources into a physically interpretable latent space, allowing the model to quantify exactly how much different data sources (like "Patents" vs. "Experiments") disagree.

Bridging the Semantic Gap with LLMs

The most recent evolution in this field involves moving away from purely statistical relationships toward semantic ones. Traditional methods might know that "Red" and "Crimson" appear in similar contexts, but they don't "know" what a color is.

Zihua Yang introduced the ARISE framework (Bridging the Semantic Gap), which uses Large Language Models (LLMs) to inject real-world knowledge into the clustering process. By using an LLM to generate semantic embeddings for categorical labels, ARISE can recognize that "Pediatrician" and "Cardiologist" are both sub-types of "Doctor," significantly boosting performance on small datasets where statistical patterns are too thin to detect.

Why It Works: From Discrete to Smooth

The common thread across these methods—whether through the Fisher kernel for Bayesian networks by Janne Leppä-aho or Multinomial Diffusion by Emiel Hoogeboom—is the transformation of "jagged" discrete data into a "smooth" continuous representation.

When we treat categories as isolated islands, we lose the ability to interpolate, generalize, and calculate gradients. By learning a principled distance metric, we build a bridge between the discrete world of human labels and the continuous world of mathematical optimization. This allows us to apply the full power of modern machine learning—from deep generative models to robust clustering—to the messy, categorical data that makes up much of the real world.

Papers in this version

Showing 60 of 87 papers.

History & citationVersion 2 · 2026-10-04

Current · Permanent link

  1. Version 2 (latest) · 2026-10-04 · 71 papers
  2. Version 1 · 2026-10-04 · 87 papers
Cite this direction

Latest version (a living page):

@misc{lacuna_categorical_data_clustering_6dc14853,
  title = {categorical data clustering},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/categorical-data-clustering/rdr_6dc14853b2b1496bb377aee18151206c},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-12-05},
}

This exact version (version 1, frozen text):

@misc{lacuna_metric_learning_for_categorical_and_nomi_6dc14853_v1,
  title = {Metric Learning for Categorical and Nominal Data},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/metric-learning-for-categorical-and-nominal-data/rdr_6dc14853b2b1496bb377aee18151206c/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-12-05},
}