Kernels and Distances for Structured Data

Thomas Gärtner, John W. Lloyd, Peter A. Flach

Abstract

Traditional machine learning algorithms often struggle with structured data, requiring manual "flattening" into fixed-length vectors. This paper introduces a principled framework for constructing kernels and distance metrics directly on complex data structures like sets, lists, and trees. By leveraging typed higher-order logic, we define a recursive "default kernel" that is mathematically guaranteed to be positive definite. Our approach bridges the gap between inductive logic programming and statistical learning, achieving state-of-the-art results on chemical and multi-instance learning benchmarks, including a significant reduction in error rate on the Diterpene dataset.

Introduction

Most classical machine learning models, such as Support Vector Machines (SVMs) and neural networks, operate on data represented as points in a Euclidean space. However, real-world data is frequently structured: molecules are graphs, documents are sequences, and user profiles are nested collections of attributes. Converting these structures into "flat" feature vectors often results in the loss of critical relational information and requires extensive domain-specific engineering.

While fields like Inductive Logic Programming (ILP) were developed to handle such complexity, they often lack the robust statistical foundations and optimization frameworks of kernel methods. This research proposes a unifying framework that uses a syntax-driven approach to define similarities (kernels) and distances (metrics) directly on structured objects represented in a typed higher-order logic.

Methodology

Knowledge Representation

The foundation of the framework is the representation of individuals as basic terms within a typed higher-order logic. This formalism allows for a natural and expressive description of nested data types. For instance, a molecule can be represented as a set of atoms, where each atom is a tuple of its properties and its connections.

The Default Kernel

The core contribution is the definition of a default kernel $k(s, t)$ that operates recursively based on the type signature of the terms $s$ and $t$:

  1. Basic Constructors: For terms with matching data constructors, the kernel is computed by summing the kernels of their respective components.
  2. Sets and Multisets: For collection types, the kernel measures overlap by computing the sum of kernels over all possible pairs of elements from the two sets.
  3. Tuples: The kernel for tuples is the sum of kernels of their corresponding elements.

Crucially, the authors provide a formal proof that this recursive definition always results in a positive definite kernel, ensuring it can be used reliably with SVMs and other kernel-based learners. Furthermore, these kernels can be transformed into pseudo-metrics, enabling the use of instance-based methods like $k$-nearest neighbor (k-NN) classifiers.

Experimental Evaluation

The framework was evaluated across several domains to test its versatility and performance.

Chemical Structure Analysis (Diterpene)

The most significant performance gain was observed on the Diterpene dataset, which consists of 1,503 NMR spectra of chemical compounds. The task is to identify the skeleton structure of the molecule.

  • Previous State-of-the-Art (RIBL): 86.5% accuracy.
  • Kernel-based approach (KeS): 94.7% accuracy.
  • Distance-based approach (DeS) with 1-NN: 97.1% accuracy.

This result represents a more than 10% absolute improvement in accuracy, effectively reducing the error rate by over two-thirds compared to specialized first-order distance methods.

Multi-Instance Learning (Musk)

On the Musk1 and Musk2 benchmarks, the framework demonstrated that Multi-Instance Learning (MIL) is a special case of set-based kernel application. The general framework achieved results competitive with specialized MIL algorithms, proving that a unified structural approach can match or exceed the performance of domain-specific heuristics.

Discussion and Conclusion

The "syntax-driven" approach provides a powerful "declarative bias." By using the type signature of the data as a roadmap for comparison, the framework allows researchers to model domain semantics—such as ignoring specific sub-structures or weighting certain attributes—within a rigorous mathematical framework.

While the recursive nature of the kernel introduces computational complexity for deeply nested structures, the benefits of avoiding manual feature engineering and achieving higher accuracy are substantial. Future work will focus on optimizing these computations and developing a dedicated declarative language to simplify the application of these kernels to new domains.

By bridging the gap between logic-based representation and kernel-based learning, this work provides a robust foundation for the next generation of structure-aware machine learning.

Summary updated

BibTeX
@article{gartner2004kernels,
  author = {Thomas Gärtner and John W. Lloyd and Peter A. Flach},
  title = {{Kernels and Distances for Structured Data}},
  journal = {Machine Learning},
  year = {2004},
  doi = {10.1023/b:mach.0000039777.23772.30},
}
Figure