---
abstract: 'Driven by a large number of potential applications in areas like bioinformatics, information retrieval and social network analysis, the problem setting of inferring relations between pairs of data objects has recently been investigated quite intensively in the machine learning community. To this end, current approaches typically consider datasets containing crisp relations, so that standard classification methods can be adopted. However, relations between objects like similarities and preferences are often expressed in a graded manner in real-world applications. A general kernel-based framework for learning relations from data is introduced here. It extends existing approaches because both crisp and graded relations are considered, and it unifies existing approaches because different types of graded relations can be modeled, including symmetric and reciprocal relations. This framework establishes important links between recent developments in fuzzy set theory and machine learning. Its usefulness is demonstrated through various experiments on synthetic and real-world data.'
author:
- |
    Willem Waegeman, Tapio Pahikkala, Antti Airola,\
    Tapio Salakoski, Michiel Stock, Bernard De Baets
bibliography:
- 'referenties.bib'
- 'myBibliography.bib'
title: |
    A kernel-based framework for learning\
    graded relations from data
---

Introduction
============

Relational data occurs in many predictive modeling tasks, such as forecasting the winner in two-player computer games [@Bowling2006], predicting proteins that interact with other proteins in bioinformatics [@Yamanishi2004], retrieving documents that are similar to a target document in text mining [@Yang2009], investigating the persons that are friends of each other on social network sites [@Taskar2004], etc. All these examples represent fields of application in which specific machine learning and data mining algorithms have been successfully developed to infer relations from data; pairwise relations, to be more specific.

The typical learning scenario in such situations can be summarized as follows. Given a dataset of known relations between pairs of objects and a feature representation of these objects in terms of variables that might characterize the relations, the goal usually consists of inferring a statistical model that takes two objects as input and predicts whether the relation of interest occurs for these two objects. Moreover, since one aims to discover unknown relations, a good learning algorithm should be able to construct a predictive model that can generalize for unseen data, i.e., pairs of objects for which at least one of the two objects was not used to construct the model. As a result of the transition from predictive models for single objects to pairs of objects, new advanced learning algorithms need to be developed, resulting in new challenges with regard to model construction, computational tractability and model assessment.

As relations between objects can be observed in many different forms, this general problem setting provides links to several subfields of machine learning, like statistical relational learning [@Deraedt2009], graph mining [@Vert2005], metric learning [@Xing2002] and preference learning [@Hullermeier2010a]. More specifically, from a graph-theoretic perspective, learning a relation can be formulated as learning edges in a graph where the nodes represent information of the data objects; from a metric learning perspective, the relation that we aim to learn should satisfy some well-defined properties like positive definiteness, transitivity or the triangle inequality; and from a preference learning perspective, the relation expresses a (degree of) preference in a pairwise comparison of data objects.

The topic of learning relations between objects is also closely related to recent developments in fuzzy set theory. This article will elaborate on these connections via two important contributions: (1) the extension of the typical setting of learning crisp relations to real-valued and ordinal-valued relations and (2) the inclusion of domain knowledge about relations into the inference process by explicit modeling of mathematical properties of these relations. For algorithmic simplicity, one can observe that many approaches only learn crisp relations, that is relations with only 0 and 1 as possible values, so that standard binary classifiers can be modified. In this context, consider examples as inferring protein-protein interaction networks or metabolic networks in bioinformatics [@Yamanishi2004; @Geurts2007].

However, graded relations are observed in many real-world applications [@Doignon1986], resulting in a need for new algorithms that take graded relational information into account. Furthermore, the properties of graded relations have been investigated intensively in the recent fuzzy logic literature[^1], and these properties are very useful to analyze and improve current algorithms. Using mathematical properties of graded relations, constraints can be imposed for incorporating domain knowledge in the learning process, to improve predictive performance or simply to guarantee that a relation with the right properties is learned. This is definitely the case for properties like transitivity when learning similarity relations and preference relations – see e.g. [@Switalski2000; @DeBaets2005; @DeBaets2006; @Diaz2007], but even very basic properties like symmetry, antisymmetry or reciprocity already provide domain knowledge that can steer the learning process. For example, in social network analysis, the notion “person A being a friend of person B" should be considered as a symmetric relation, while the notion “person A defeats person B in a chess game" will be antisymmetric (or, equivalently, reciprocal). Nevertheless, many examples exist, too, where neither symmetry nor antisymmetry necessarily hold, like the notion “person A trusts person B".

In this paper we present a general kernel-based approach that unifies all the above cases into one general framework where domain knowledge can be easily specified by choosing a proper kernel and model structure, while different learning settings are distinguished by means of the loss function. Let ${Q}({v},{v}')$ be a binary relation on an object space ${\mathcal{V}}$, then the following learning settings will be considered in particular:

Crisp relations: when the restriction is made that $Q: {\mathcal{V}}^2 \rightarrow \{0,1\}$, we arrive at a binary classification task with pairs of objects as input for the classifier.

$[0,1]$-valued relations: here it is allowed that relations can take the form $Q: {\mathcal{V}}^2 \rightarrow [0,1]$, resulting in a regression type of learning setting. The restriction to the interval $[0,1]$ is predominantly made because many mathematical frameworks in fields like fuzzy set theory and decision theory are built upon such relations, using the notion of a fuzzy relation, but in general one can account quite easily for real-graded relations by applying a scaling operation from ${\mathbb{R}}$ to $[0,1]$.

Ordinal-valued relations: situated somewhat in the middle between the other two settings, here it is assumed that the actual values of the relation do not matter but rather the provided order information should be learned.

Furthermore, one can integrate different types of domain knowledge in our framework, by guaranteeing that certain properties are satisfied. The following cases can be distinguished:

Symmetric relations. Applications arise in many domains and metric learning or learning similarity measures can be seen as special cases that require additional properties to hold, such as the triangle inequality for metrics and positive definiteness or transitivity properties for similarity measures. As shown below, learning symmetric relations can be interpreted as learning edges in an undirected graph.

Reciprocal or antisymmetric relations. Applications arise here in domains such as preference learning, game theory and bioinformatics for representing preference relations, choice probabilities, winning probabilities, gene regulation, etc. We will provide a formal definition below, but, given a rescaling operation from ${\mathbb{R}}$ to $[0,1]$, antisymmetric relations can be converted into reciprocal relations. Similar to symmetric relations, transitivity properties typically guarantee additional constraints that are definitely required for certain applications. It is, for example, well known in decision theory and preference modeling that transitive preference relations result in utility functions [@Luce1965; @Bodenhofer2007]. Learning reciprocal or antisymmetric relations can be interpreted as learning edges in a directed graph.

Ordinary binary relations. Many applications can be found where neither symmetry nor reciprocity holds. From a graph inference perspective, learning such relations should be seen as learning the edges in a bidirectional graph, where edges in one direction do not impose constraints on edges in the other direction.

Indeed, the framework that we propose below strongly relies on graphs, where nodes represent the data objects that are studied and the edges represent the relations present in the training set. The weights on the edges characterize the values of known relations, while unconnected nodes indicate pairs of objects for which the unknown relation needs to be predicted. The left graph in Figure \[fig:examples\] visualizes a toy example representing the most general case where neither symmetry nor reciprocity holds. Depending on the application, the learning algorithm should try to predict the relations for three types of object pairs:

-   pairs of objects that are already present in the training dataset by means of other edges, like the pair (A,B),

-   pairs of objects for which one of the two objects occurs in the training dataset, like the pair (E,F),

-   pairs of objects for which none of the two objects is observed during training, like the pair (F,G).

The graphs on the right-hand side in Figure \[fig:examples\] show examples of specific types of relations that are covered by our framework. The differences between these relations will become more clear in the following sections.

![Left: example of a multi-graph representing the most general case, where no additional properties of relations are assumed. Right: examples of eight different types of relations in a graph of cardinality three. The following relational properties are illustrated: (C) crisp, (G) graded, (R) reciprocal, (S) symmetric, (T) transitive and (I) intransitive. For the reciprocal relations, (I) refers to a relation that does not satisfy weak stochastic transitivity, while (T) is showing an example of a relation fulfilling strong stochastic transitivity. For the symmetric relations, (I) refers a relation that does not satisfy $T$-transitivity w.r.t. the Łukasiewicz t-norm $T_{\bf L}(a,b) = \max(a+b-1,0)$, while (T) is showing an example of a relation that fulfills $T$-transitivity w.r.t. the product t-norm $T_{\bf P}(a,b) = ab$. See Section 4 for formal definitions of transitivity.[]{data-label="fig:examples"}](exampleMultiGen.pdf)

\
\
\

General framework
=================

Notation and basic concepts
---------------------------

Let us start with introducing some notations. We assume that the data is structured as a graph $G = ({\mathcal{V}},{\mathcal{E}},{Q})$, where ${\mathcal{V}}$ corresponds to the set of nodes ${v}$ and ${\mathcal{E}}\subseteq {\mathcal{V}}^2$ represents the set of edges ${e}$, for which training labels are provided in terms of relations. Moreover, these relations are represented by training weights ${y}_{{e}}$ on the edges, generated from an unknown underlying relation ${Q}: {\mathcal{V}}^2 \rightarrow [0,1]$. Relations are required to take values in the interval $[0,1]$ because some properties that we need are historically defined for such relations, but an extension to real-graded relations ${h}: {\mathcal{V}}^2 \rightarrow {\mathbb{R}}$ can always be realized. Consider $b \in {\mathbb{R}}^+$ and an increasing isomorphism $\sigma : [-b,b] \rightarrow [0,1]$ that satisfies $\sigma(x) = 1 - \sigma(-x)$, then we consider the ${\mathbb{R}}\rightarrow [0,1]$ mapping $\nabla$ defined by: $$\begin{aligned}
\nabla(x) & = & \left\{ \begin{array}{ll} 0, &
\textrm{if $ x \le -b$}\\
\sigma(x), &  \textrm{if $-b \le x \le b$} \\
1, & \textrm{if $b \le x$}
\end{array} \right.\end{aligned}$$ and its inverse $\nabla^{-1} = \sigma^{-1}$.

Any real-valued relation ${h}: {\mathcal{V}}^2 \rightarrow {\mathbb{R}}$ can be transformed into a $[0,1]$-valued relation $Q$ as follows: $$\begin{aligned}
\label{eq:monmap}
Q({v},{v}') = \nabla(h({v},{v}')) \,, \quad \forall ({v},{v}') \in {\mathcal{V}}^2 \,,\end{aligned}$$ and conversely by means of $\nabla^{-1}$. In what follows we tacitly assume that $\nabla$ has been fixed.

Following the standard notations for kernel methods, we formulate our learning problem as the selection of a suitable function ${h}\in{\mathcal{H}}$, with ${\mathcal{H}}$ a certain hypothesis space, in particular a reproducing kernel Hilbert space (RKHS). More specifically, the RKHS supports in our case hypotheses $h: {\mathcal{V}}^2 \rightarrow {\mathbb{R}}$ denoted as $$\begin{aligned}
\label{eq:primalmodel}
h({e}) =  {\mathbf{w}}^T \Phi({e}) \,,\end{aligned}$$ with ${\mathbf{w}}$ a vector of parameters that needs to be estimated from training data, $\Phi$ a joint feature mapping for edges in the graph (see below) and ${\mathbf{a}}^T$ the transpose of a vector ${\mathbf{a}}$. Let us denote a training dataset of cardinality ${q}= |{\mathcal{E}}|$ as a set $T = \{({e},{y}_{{e}}) \mid {e}\in {\mathcal{E}}\}$ of input-label pairs, then we formally consider the following optimization problem, in which we select an appropriate hypothesis ${h}$ from ${\mathcal{H}}$ for training data $T$: $$\begin{aligned}
\label{regalgorithm}
\hat{{h}}=\operatorname*{argmin}_{{h}\in{\mathcal{H}}} \frac{1}{q} \sum_{{e}\in {\mathcal{E}}} {\mathcal{L}}({h}({e}),{y}_{{e}})
+{\lambda}\Arrowvert {h}\Arrowvert_{{\mathcal{H}}}^2 \,\end{aligned}$$ with ${\mathcal{L}}$ a given loss function, $\Arrowvert \cdot \Arrowvert_{{\mathcal{H}}}^2$ the traditional quadratic regularizer on the RKHS and ${\lambda}>0$ a regularization parameter. According to the representer theorem [@Scholkopf2002], any minimizer ${h}\in{\mathcal{H}}$ of (\[regalgorithm\]) admits a dual representation of the following form: $$\begin{aligned}
\label{eq:dualmodel}
{h}({\overline{{e}}})
= {{\mathbf{w}}}^T \Phi({\overline{{e}}}) = \sum_{{e}\in {\mathcal{E}}}
{a}_{{e}}{K}^{\Phi}({e},{\overline{{e}}}) \,,\end{aligned}$$ with ${a}_{{e}} \in\mathbb{R}$ dual parameters, ${K}^{\Phi}$ the kernel function associated with the RKHS and $\Phi$ the feature mapping corresponding to ${K}^{\Phi}$ and $$\begin{aligned}
{{\mathbf{w}}}=\sum_{{e}\in {\mathcal{E}}}
{a}_{{e}}\Phi({e}).\end{aligned}$$ We will alternate several times between the primal and dual representation for ${h}$ in the remainder of this article.

The primal representation as defined in (\[eq:primalmodel\]) and its dual equivalent (\[eq:dualmodel\]) yield an RKHS defined on edges in the graph. In addition, we will establish an RKHS defined on nodes, as every edge consists of a couple of nodes. Given an input space $\mathcal{V}$ and a kernel ${K}:\mathcal{V}\times\mathcal{V}\rightarrow\mathbb{R}$, the RKHS associated with ${K}$ can be considered as the completion of $$\left\{ f \in \mathbb{R}^\mathcal{V}  \left\arrowvert
f({v})=\sum_{i=1}^m\beta_i{K}({v},{v}_i)\right.\right\},$$ in the norm $$\Arrowvert f\Arrowvert_{K}=\sqrt{\sum_{i,j}\beta_i\beta_j{K}({v}_i,{v}_j)},$$ where $\beta_i\in\mathbb{R},m\in\mathbb{N},{v}_i\in\mathcal{V}$.

Learning arbitrary relations
----------------------------

As mentioned in the introduction, both crisp and graded relations can be handled by our framework. To make a subdivision between different cases, a loss function needs to be specified. For crisp relations, one can typically use the hinge loss, which is given by: $$\begin{aligned}
{\mathcal{L}}({h}({e}),{y}) = [1- {y}{h}({e})]_+ \,,\end{aligned}$$ with $[\cdot]_+$ the positive part of the argument. Alternatively, one can opt to optimize a probabilistic loss function like the logistic loss: $$\begin{aligned}
{\mathcal{L}}({h}({e}),{y}) = \ln(1+\exp(-{y}{h}({e}))) \,.\end{aligned}$$ Conversely, if in a given application the observed relations are graded instead of crisp, other loss functions have to be considered. Hence, we will run experiments with a least-squares loss function: $$\label{regrloss}
{\mathcal{L}}({h}({e}),{y}) = ({y}_{e}-{h}({e}))^2 \,,$$ resulting in a regression type of learning setting. Alternatively, one could prefer to optimize a more robust regression loss like the $\epsilon$-insensitive loss, in case outliers are expected in the training dataset. So far, our framework does not differ from standard classification and regression algorithms. However, the specification of a more precise model structure for (\[eq:primalmodel\]) offers a couple of new challenges. In the most general case, when no further restrictions on the underlying relation can be specified, the following Kronecker product feature mapping is proposed to express pairwise interactions between features of nodes: $$\begin{aligned}
\Phi({e}) = \Phi({v},{v}') = \phi({v}) \otimes \phi({v}')\,,\end{aligned}$$ where $\phi$ represents the feature mapping for individual nodes. A formal definition of the Kronecker product can be found in the appendix. As first shown in [@Ben-Hur2005], the Kronecker product pairwise feature mapping yields the Kronecker product edge kernel (a.k.a. the tensor product pairwise kernel) in the dual representation: $$\begin{aligned}
\label{eq:tppk}
{K}_{\otimes}^{\Phi}({e},{\overline{{e}}}) = {K}_{\otimes}^{\Phi}({v},{v}',{\overline{{v}}},{\overline{{v}}}')= {K}^{\phi}({v},{\overline{{v}}}) {K}^{\phi}({v}',{\overline{{v}}}') \,,\end{aligned}$$ with $K^{\phi}$ the kernel corresponding to $\phi$.

This section aims to formally prove that the Kronecker product edge kernel is the best kernel one can choose, when no further domain knowledge is provided about the underlying relation that generates the data. We claim that with an appropriate choice for $K^{\phi}$, such as the Gaussian RBF kernel, the kernel $K^{\Phi}$ generates a class ${\mathcal{H}}$ of universally approximating functions for learning any type of relation. Armed with the definition of universality for kernels and the Stone-Weierstra[ß]{} theorem [@Steinwart2002consistency], we arrive at the following theorem concerning the Kronecker product pairwise kernels:

\[unikrontheorem\] Let us assume that the space of nodes ${\mathcal{V}}$ is a compact metric space. If a continuous kernel ${K}^\phi$ is universal on ${\mathcal{V}}$, then ${K}_{\otimes}^\Phi$ defines a universal kernel on ${\mathcal{E}}$.

The proof can be found in the appendix. We would like to emphasize that one cannot conclude from the theorem that the Kronecker product pairwise kernel is the best kernel to use in all possible situations. The theorem only shows that the Kronecker product pairwise kernel makes a reasonably good choice, if no further domain knowledge about the underlying relation is known. Namely, the theorem says that given a suitable sample of data, the RKHS of the kernel contains functions that are arbitrarily close to any continuous relation in the uniform norm. However, the theorem does not say anything about how likely it is to have, as a training set, such a data sample that can represent the approximating function. Further, the theorem only concerns graded relations that are continuous and therefore crisp relations and graded, discontinuous relations require more detailed considerations.

Other kernel functions might of course outperform the Kronecker product pairwise kernel in applications where domain knowledge can be incorporated in the kernel function. In the following section we discuss reciprocity, symmetry and transitivity as three relational properties that can be represented by means of more specific kernel functions. As a side note, we also introduce the Cartesian pairwise kernel, which is formally defined as follows $$K_{C}^{\Phi}({v},{v}',{\overline{{v}}},{\overline{{v}}}') = K^{\phi}({v}', {\overline{{v}}}') [{v}= {\overline{{v}}}] + K^{\phi}({v},{\overline{{v}}}) [{v}' = {\overline{{v}}}'] \,,$$ with $[.]$ the indicator function, returning one when both elements are identical and zero otherwise. This kernel was recently proposed by [@Kashima2009] as an alternative to the Kronecker product pairwise kernel. By construction, the Cartesian pairwise kernel has important limitations, since it cannot generalize to couples of nodes for which both nodes did not appear in the training dataset.

Special relations
=================

Thus, if no further information is available about the relation that underlies the data, one should definitely use the Kronecker product edge kernel. In this most general case, we allow that for any pair of nodes in the graph several edges can exist, in which an edge in one direction does not necessarily impose constraints on the edge in the opposite direction. Multiple edges in the same direction can connect two nodes, leading to a multi-graph as in Figure \[fig:examples\], where two different edges in the same direction connect nodes $D$ and $E$. This construction is required to allow repeated measurements. However, two important subclasses of relations deserve further attention: reciprocal relations and symmetric relations.

Reciprocal relations
--------------------

This subsection briefly summarizes our previous work on learning reciprocal relations [@Pahikkala2010]. Let us start with a definition of this type of relation.

A binary relation ${Q}: {\mathcal{V}}^2 \rightarrow [0,1]$ is called a reciprocal relation if for all $({v},{v}') \in {\mathcal{V}}^2$ it holds that ${Q}({v},{v}') = 1 - {Q}({v}',{v})$.

A binary relation ${h}: {\mathcal{V}}^2 \rightarrow {\mathbb{R}}$ is called an antisymmetric relation if for all $({v},{v}') \in {\mathcal{V}}^2$ it holds that ${h}({v},{v}') = - {h}({v}',{v})$.

For reciprocal and antisymmetric relations, every edge ${e}=({v},{v}')$ in a multi-graph like Figure \[fig:examples\] induces an unobserved invisible edge ${e}_R = ({v}',{v})$ with appropriate weight in the opposite direction. The transformation operator $\nabla$ transforms an antisymmetric relation into a reciprocal relation. Applications of reciprocal relations arise here in domains such as preference learning, game theory and bioinformatics for representing preference relations, choice probabilities, winning probabilities, gene regulation, etc. The weight on the edge defines the real direction of such an edge. If the weight on the edge ${e}= ({v},{v}')$ is higher than 0.5, then the direction is from $v$ to $v'$, but when the weight is lower than 0.5, then the direction should be interpreted as inverted, for example, the edges from $A$ to $C$ in Figures \[fig:examples\] (a) and (e) should be interpreted as edges starting from $A$ instead of $C$. If the relation is $3$-valued as $Q: {\mathcal{V}}^2 \rightarrow \{0,1/2,1\}$, then we end up with a three-class ordinal regression setting instead of an ordinary regression setting.

Interestingly, reciprocity can be easily incorporated in our framework.

Let $\Psi$ be a feature mapping on ${\mathcal{V}}^2$ and let ${h}$ be a hypothesis defined by (\[eq:primalmodel\]), then the relation $Q$ of type (\[eq:monmap\]) is reciprocal if $\Phi$ is given by $$\Phi_R({e})=\Phi_R({v},{v}')=\Psi({v},{v}')-\Psi({v}',{v}) \,.$$

The proof is immediate. In addition, one can easily show that reciprocity as domain knowledge can be enforced in the dual formulation. Let us in the least restrictive form now consider the Kronecker product for $\Psi$, then one obtains for $\Phi_R$ the kernel $K_{\otimes R}^{\Phi}$ given by $K_{\otimes R}^{\Phi}({e},{\overline{{e}}})=$ $$\begin{aligned}
\label{eq:recedgekernel}
2 \big(K^{\phi}({v},{\overline{{v}}}) K^{\phi}({v}',{\overline{{v}}}') - K^{\phi}({v},{\overline{{v}}}') K^{\phi}({v}',{\overline{{v}}})\big)\,.\end{aligned}$$ The following theorem shows that this kernel can represent any type of reciprocal relation.

\[antisymmetrictheorem\] Let $$R({\mathcal{V}}^2)=\{ t \mid t \in C({\mathcal{V}}^2),t({v},{v}')= - t({v}',{v})\}$$ be the space of all continuous antisymmetric relations from ${\mathcal{V}}^2$ to $\mathbb{R}$. If $K^\phi$ on ${\mathcal{V}}$ is universal, then for every function $t\in R({\mathcal{V}}^2)$ and every $\epsilon > 0$, there exists a function $h$ in the RKHS induced by the kernel $K_{\otimes R}^{\Phi}$ defined in (\[eq:recedgekernel\]), such that $$\label{recclaim}
\max_{({v},{v}')\in {\mathcal{V}}^2}\left\{\left\arrowvert t({v},{v}')-{h}({v},{v}')\right\arrowvert\right\}\leq\epsilon \,.$$

The proof can be found in the appendix.

Symmetric relations
-------------------

Symmetric relations form another important subclass of relations in our framework. As a specific type of symmetric relations, similarity relations constitute the underlying relation in many application domains where relations between objects need to be learned. Symmetric relations are formally defined as follows.

A binary relation ${Q}: {\mathcal{V}}^2 \rightarrow [0,1]$ is called a symmetric relation if for all $({v},{v}') \in {\mathcal{V}}^2$ it holds that ${Q}({v},{v}') = {Q}({v}',{v})$.

A binary relation ${h}: {\mathcal{V}}^2 \rightarrow {\mathbb{R}}$ is called a symmetric relation if for all $({v},{v}') \in {\mathcal{V}}^2$ it holds that ${h}({v},{v}') = {h}({v}',{v})$.

Note that $\nabla$ preserves symmetry. For symmetric relations, edges in multi-graphs like Figure \[fig:examples\] become undirected. Applications arise in many domains and metric learning or learning similarity measures can be seen as special cases. If the relation is $2$-valued as $Q: {\mathcal{V}}^2 \rightarrow \{0,1\}$, then we end up with a classification setting instead of a regression setting.

Just like reciprocal relations, it turns out that symmetry can be easily incorporated in our framework.

Let $\Psi$ be a feature mapping on ${\mathcal{V}}^2$ and let ${h}$ be a hypothesis defined by (\[eq:primalmodel\]), then the relation $Q$ of type (\[eq:monmap\]) is symmetric if $\Phi$ is given by $$\Phi_S({e})=\Phi_S({v},{v}')=\Psi({v},{v}')+\Psi({v}',{v}) \,.$$

In addition, by using mathematical properties of the Kronecker product, one obtains in the dual formulation an edge kernel that looks very similar to the one derived for reciprocal relations. Let us again consider the Kronecker product for $\Psi$, then one obtains for $\Phi_S$ the kernel $K_{\otimes S}^{\Phi}$ given by $K_{\otimes S}^{\Phi}({e},{\overline{{e}}})=$ $$\begin{aligned}
2 \big(K^{\phi}({v},{\overline{{v}}}) K^{\phi}({v}',{\overline{{v}}}') + K^{\phi}({v},{\overline{{v}}}') K^{\phi}({v}',{\overline{{v}}})\big) \,.\end{aligned}$$ Thus, the substraction of kernels in the reciprocal case becomes an addition of kernels in the symmetric case. The above kernel has been used for predicting protein-protein interactions in bioinformatics [@Ben-Hur2005] and it has been theoretically analyzed in [@Hue2010]. More specifically, for some methods one has shown in the latter paper that enforcing symmetry in the kernel function yields identical results as adding every edge twice to the dataset, by taking each of the two nodes once as first element of the edge. Unlike many existing kernel-based methods for pairwise data, the models obtained with these kernels are able to represent any reciprocal or symmetric relation respectively, without imposing additional transitivity properties of the relations.

We also remark that for symmetry as well, one can prove that the Kronecker product edge kernel yields a model that is flexible enough to represent any type of underlying relation.

Let $$S({\mathcal{V}}^2)=\{t \mid t\in C({\mathcal{V}}^2),t({v},{v}')=t({v}',{v})\}$$ be the space of all continuous symmetric relations from ${\mathcal{V}}^2$ to $\mathbb{R}$. If $K^\phi$ on ${\mathcal{V}}$ is universal, then for every function $t\in S({\mathcal{V}}^2)$ and every $\epsilon > 0$, there exists a function $h$ in the RKHS (\[eq:primalmodel\]) induced by the kernel (\[eq:recedgekernel\]), such that $$\max_{({v},{v}')\in {\mathcal{V}}^2}\left\{\left\arrowvert t({v},{v}')-{h}({v},{v}')\right\arrowvert\right\}\leq\epsilon.$$

The proof is analogous to that of Theorem \[antisymmetrictheorem\] (see appendix).

As a side note, we remark that a symmetric and reciprocal version of the Cartesian kernel can be introduced as well.

Relationships with fuzzy set theory
===================================

The previous section revealed that specific Kronecker product edge kernels can be constructed for modeling reciprocal and symmetric relations, without requiring any further background about these relations. In this section we demonstrate that the Kronecker product edge kernels $K_{\otimes}^{\Phi}$, $K_{\otimes R}^{\Phi}$ and $K_{\otimes S}^{\Phi}$ are particularly useful for modeling intransitive relations. Intransitive relations occur in a lot of real-world scenarios, like game playing [@DeSchuymer2003; @Fisher2008], competition between bacteria [@Kerr2002; @czaran2002chemical; @nowak2002; @Kirkup2004; @karolyi2005rps; @reichenbach2007] and fungi [@Boddy2000], mating choice of lizards [@Sinervo1996] and food choice of birds [@Waite2001], to name just a few. In an informal way, Figure \[fig:examples\] shows with the help of examples what transitivity means for symmetric and reciprocal relations that are crisp and graded.

Despite the occurrence of intransitive relations in many domains, one has to admit that most applications are still characterized by relations that fulfill relatively strong transitivity requirements. For example, in decision making, preference modeling and social choice theory, one can argue that reciprocal relations like choice probabilities and preference judgments should satisfy certain transitivity properties, if they represent rational human decisions made after well-reasoned comparisons on objects [@Luce1965; @Fishburn1991; @Tversky1998]. For symmetric relations as well, transitivity plays an important role [@Gower1986; @Jakel2008], when modeling similarity relations, metrics, kernels, etc.

It is for this reason that transitivity properties have been studied extensively in fuzzy set theory and related fields. For reciprocal relations, one traditionally uses the notion of stochastic transitivity [@Luce1965].

Let $g$ be an increasing $[1/2,1]^2 \rightarrow [0,1]$ mapping. A reciprocal relation $Q: {\mathcal{V}}^2 \rightarrow [0,1]$ is called $g$-stochastic transitive if for any $({v}_1,{v}_2,{v}_3)
\in {\mathcal{V}}^3$ $$\begin{aligned}
\big( Q({v}_1,{v}_2) \geq 1/2 \wedge Q({v}_2,{v}_3) \geq 1/2 \big)
\Rightarrow Q({v}_1,{v}_3) \geq
g(Q({v}_1,{v}_2),Q({v}_2,{v}_3))\,.\end{aligned}$$

Important special cases are weak stochastic transitivity when $g(a,b) =
1/2$, moderate stochastic transitivity when $g(a,b) =
\min(a,b)$ and strong stochastic transitivity when $g(a,b) =
\max(a,b)$. Alternative (and more general) frameworks are FG-transitivity [@Switalski2003] and cycle transitivity [@DeBaets2005; @DeBaets2006]. For graded symmetric relations, the notion of $T$-transitivity has been put forward [@DeBaets2002; @Moser2006].

A symmetric relation $Q: {\mathcal{V}}^2 \rightarrow [0,1]$ is called $T$-transitive with $T$ a t-norm if for any $({v}_1,{v}_2,{v}_3) \in {\mathcal{V}}^3$ $$\begin{aligned}
T(Q({v}_1,{v}_2),Q({v}_2,{v}_3)) \leq
Q({v}_1,{v}_3)\,.\end{aligned}$$

Three important t-norms are the minimum t-norm $T_{\bf M}(a,b) = \min(a,b)$, the product t-norm $T_{\bf P}(a,b) = ab$ and the Łukasiewicz t-norm $T_{\bf
L}(a,b) = \max(a+b-1,0)$.

In addition, several authors have shown that various forms of transitivity give rise to utility representable or numerically representable relations, also called fuzzy weak orders – see e.g. [@Luce1965; @Billot1995; @Koppen1995; @Fono2007; @Bodenhofer2007]. We will use the term ranking representability to establish a link with machine learning. We give a slightly specific definition that unifies reciprocal and symmetric relations.

A reciprocal or symmetric relation ${Q}: {\mathcal{V}}^2 \rightarrow [0,1]$ is called ranking representable if there exists a ranking function ${f}: {\mathcal{V}}\rightarrow {\mathbb{R}}$ such that for all $({v},{v}')
\in {\mathcal{V}}^2$ it respectively holds that

${Q}({v},{v}') = \nabla ({f}({v}) - {f}({v}')) \,$ (reciprocal case) ;

${Q}({v},{v}') = \nabla ({f}({v}) + {f}({v}')) \,$ (symmetric case) .

The main idea is that ranking representable relations can be constructed from a utility function $f$. Ranking representable reciprocal relations correspond to directed acyclic graphs, and a unique ranking of the nodes in such graphs can be obtained with topological sorting algorithms. The ranking representable reciprocal relations of Figures \[fig:examples\] (a) and (e) for example yield the global ranking $A \succ B \succ C$. Interestingly, ranking representability of reciprocal relations and symmetric relations can be easily achieved in our framework by simplifying the joint feature mapping $\Psi$. Let $\Psi({v},{v}') = \phi({v})$ such that $K^{\Phi}$ simplifies to $$\begin{aligned}
\arraycolsep=2pt
K_{{f}R}^{\Phi}({e},{\overline{{e}}})&=&K^{\phi}({v},{\overline{{v}}}) + K^{\phi}({v}',{\overline{{v}}}')  -K^{\phi}({v},{\overline{{v}}}') -
K^{\phi}({v}',{\overline{{v}}}) \,, \\
K_{{f}S}^{\Phi}({e},{\overline{{e}}})&=&K^{\phi}({v},{\overline{{v}}}) + K^{\phi}({v}',{\overline{{v}}}') +K^{\phi}({v},{\overline{{v}}}') +
K^{\phi}({v}',{\overline{{v}}}) \,,\end{aligned}$$ when $\Phi({v},{v}') = \Phi_R({v},{v}')$ or $\Phi({v},{v}') = \Phi_S({v},{v}')$, respectively, then the following proposition holds.

The relation $Q: {\mathcal{V}}^2 \rightarrow [0,1]$ given by (\[eq:monmap\]) and $h$ defined by (\[eq:primalmodel\]) with $K^{\Phi} = K_{{f}R}^{\Phi}$ (respectively $K^{\Phi} = K_{{f}S}^{\Phi}$) is a ranking representable reciprocal (respectively symmetric) relation.

The proof directly follows from the fact that for this specific kernel, ${h}({v},{v}')$ can be respectively written as ${f}({v}) - {f}({v}')$ and ${f}({v}) + {f}({v}')$. The kernel $K_{{f}R}^{\Phi}$ has been initially introduced in [@Herbrich2000] for ordinal regression and during the last decade it has been extensively used as a main building block in many kernel-based ranking algorithms. Since ranking representability of reciprocal relations implies strong stochastic transitivity of reciprocal relations, $K_{{f}R}^{\Phi}$ can represent this type of domain knowledge.

The notion of ranking representability is powerful for reciprocal relations, because the majority of reciprocal relations satisfy this property, but for symmetric relations it has a rather limited applicability. Ranking representability as defined above cannot represent relations that originate from an underlying metric or similarity measure. For such relations, one needs another connection with its roots in Euclidean metric spaces [@Gower1986].

A symmetric relation ${Q}: {\mathcal{V}}^2 \rightarrow [0,1]$ is called Euclidean representable if there exists a ranking function $f: {\mathcal{V}}\rightarrow {\mathbb{R}}$ such that for all pairs $({v},{v}')
\in {\mathcal{V}}^2$ it holds that $$\begin{aligned}
\label{eq:rrsym}
{Q}({v},{v}') = \nabla (({f}({v}) - {f}({v}'))^T({f}({v}) - {f}({v}'))) \,,\end{aligned}$$ with $\vec{a}^T$ the transpose of a vector $\vec{a}$.

Euclidean representability as defined here basically can be seen as Euclidean embedding or Multidimensional Scaling in a $z$-dimensional space [@Zhang2003]. In its most restrictive form, when $z=1$, it implies that the symmetric relation can be constructed from the Euclidean distance in a one-dimensional space. When such a one-dimensional embedding can be realized, one global ranking of the objects can be found, similar to reciprocal relations. Nevertheless, although models of type (\[eq:rrsym\]) with $z=1$ are sometimes used in graph inference [@Vert2005] and semi-supervised learning [@Belkin2006], we believe that situations where symmetric relations become Euclidean representable in a one-dimensional space occur very rarely, in contrast to reciprocal relations. The extension to $z > 1$ on the other hand does not guarantee the existence of one global ranking, then Euclidean representability still enforces some interesting properties, because it guarantees that the relation $Q$ is constructed from a Euclidean metric space with a dimension upper bounded by the number of nodes ${p}$. Moreover, this type of domain knowledge about relations can be incorporated in our framework. To this end, let $\Phi({v},{v}') = \Phi_S({v},{v}')$ and let $\Psi({v},{v}') = \phi({v}) \otimes (\phi({v}) - \phi({v}'))$ such that $K^{\Phi}$ becomes $$\begin{aligned}
\arraycolsep=2pt
K_{\rm MLPK}^{\Phi}({e},{\overline{{e}}}) &=& (K_{fR}^{\Phi}({e},{\overline{{e}}}))^2 \\
&=& \big(K^{\phi}({v},{\overline{{v}}}) + K^{\phi}({v}',{\overline{{v}}}') -K^{\phi}({v},{\overline{{v}}}') -
K^{\phi}({v}',{\overline{{v}}})\big)^2 \,.\end{aligned}$$ This kernel has been called the metric learning pairwise kernel by [@Vert2007]. As a consequence, the vector of parameters ${{\mathbf{w}}}$ can be rewritten as an ${r}\times {r}$ matrix ${\mathbf{W}}$ where ${\mathbf{W}}_{ij}$ corresponds to the parameter associated with $(\phi_i({v}) - \phi_i({v}'))(\phi_j({v}) - \phi_j({v}'))$ such that ${\mathbf{W}}_{ij} = {\mathbf{W}}_{ji}$.

\[thm:mlpk\] If ${\mathbf{W}}$ is positive semi-definite, then the symmetric relation $Q: {\mathcal{V}}^2 \rightarrow [0,1]$ given by (\[eq:monmap\]) with $h$ defined by (\[eq:primalmodel\]) and $K^{\Phi} = K_{\rm MLPK}^{\Phi}$ is an Euclidean representable symmetric relation.

See the appendix for the proof. Although the model established by $K_{\rm MLPK}^{\Phi}$ does not result in a global ranking, this model strongly differs from the one established with $K_{\otimes S}^{\Phi}$, since $K_{\rm MLPK}^{\Phi}$ can only represent symmetric relations that exhibit transitivity properties. Therefore, one should definitely use $K_{\rm MLPK}^{\Phi}$ when, for example, the underlying relation corresponds to a metric or a similarity relation, while the kernel $K_{\otimes S}^{\Phi}$ should be preferably used for symmetric relations for which no further domain knowledge can be assumed beforehand.

Relationships with other machine learning algorithms
====================================================

As explained in Section 2, the transition from a standard classification or regression setting to the setting of learning graded relations should be rather found in the specification of joint feature mappings over couples of objects, thereby naturally leading to the introduction of specific kernels. Any existing machine learning algorithm for classification or regression can in principle be adopted if joint feature mappings are constructed explicitly. Since kernel methods avoid this explicit construction, they can often outperform non-kernelized algorithms in terms of computational efficiency [@Scholkopf2002]. As a second main advantage, kernel methods allow to express similarity scores for structured objects, such as strings, graphs and trees and text [@Shawetaylor2004]. In our setting of learning graded relations, this implies that one should plug these domain-specific kernel functions into (\[eq:tppk\]) or the other pairwise kernels that are discussed in this paper. Such a scenario is in fact common practice in some applications of Kronecker product pairwise kernels, such as predicting protein-ligand compatibility in bioinformatics [@Jacob2008]. String kernels or graph kernels can be defined on various types of biological structures [@Vishwanathan2010] and Kronecker product pairwise kernels then combine these object-based kernels into relation-based kernels (thus, node kernels versus edge kernels).

The edge kernels we discussed in this article can be utilized within a wide variety of kernel methods. Since we focus on learning graded relations, one naturally arrives at a regression setting. In the following section, we run some experiments with regularized least-squares methods, which optimize (\[regrloss\]) using a hypothesis space induced by kernels. The solution is found by simply solving a system of linear equations [@Saunders1998; @Suykens2002; @Shawetaylor2004; @pahikkala2009preferences].

Apart from kernel methods, we briefly mention a number of other algorithms that are somewhat connected, even though they provide solutions for different learning problems. If pairwise relations are considered between objects of two different domains, one arrives at a learning setting that is referred to as predicting labels for dyadic data [@Menon2010]. Examples of such settings include link prediction in bipartite graphs and movie recommendation for users. As such, one could also argue that specific link prediction and matrix factorization methods could be applied in our setting as well, see e.g. [@Srebro2005; @Miller2009; @Lawrence2009]. However, these methods have been primarily designed for exploiting relationships in the output space, whereas feature representations of the objects are often not observed or simply irrelevant. Moreover, similar to the Cartesian pairwise kernel, these methods cannot be applied in situations where predictions need to be made for two new nodes that were not present in the training dataset.

Another connection can be observed with multivariate regression and structured output prediction methods. Such methods have been occasionally applied in settings where relations had to be learned [@Geurts2007]. Also recall that structured output prediction methods use Kronecker product pairwise kernels on a regular basis to define joint feature representations of inputs and outputs [@Tsochantaridis2005; @Weston2007].

In addition to predictive models for dyadic data, one can also detect connections with certain information retrieval and pattern matching methods. However, these methods predominantly use similarity as underlying relation, often in a purely intuitive manner, as a nearest neighbor type of learning, so they can be considered as much more restrictive. Consider the example of protein ranking [@Weston2004] or algorithms like *query by document* [@Yang2009]. These methods simply look for rankings where the most similar objects w.r.t. the query object appear on top, contrary to our approach, which should be considered as much more general, since we learn rankings from any type of binary relation. Nonetheless, similarity relations will of course still occupy a prominent place in our framework as an important special case.

Experiments
===========

In the experiments, we test the ability of the pairwise kernels to model different types of relations, and the effect of enforcing prior knowledge about the properties of the learned relations. To this end, we train the regularized least-squares (RLS) algorithm to regress the relation values [@pahikkala2009preferences]. We perform experiments on both symmetric and reciprocal relations, considering both synthetic and real-world data. In addition to the standard, symmetric and reciprocal Kronecker product pairwise kernels, we also consider the Cartesian kernel, the symmetric Cartesian kernel and the metric learning pairwise kernel.

  Abbreviation             Method
  ------------------------ ----------------------------------------------
  MPRED                    Predicting the mean
  $K_{\otimes}^{\Phi}$     Kronecker Product Pairwise Kernel
  $K_{\otimes S}^{\Phi}$   Symmetric Kronecker Product Pairwise Kernel
  $K_{\otimes R}^{\Phi}$   Reciprocal Kronecker Product Pairwise Kernel
  $K_{\rm MLPK}^{\Phi}$    Metric Learning Pairwise Kernel
  $K_{C}^{\Phi}$           Cartesian Product Pairwise Kernel
  $K_{C S}^{\Phi}$         Symmetric Cartesian Pairwise Kernel

  : Methods considered in the experiments[]{data-label="abbreviations"}

Synthetic data: learning similarity measures
--------------------------------------------

Experiments on synthetic data were conducted to illustrate the behavior of the different kernels in terms of the transitivity of the relation to be learned. A parametric family of cardinality-based similarity measures for sets was considered as the relation of interest [@DeBaets2001]. For two sets $A$ and $B$, let us define the following cardinalities: $$\begin{aligned}
\arraycolsep=2pt
\Delta_{A,B} &=& |A \setminus B| + |B \setminus A| \,, \\
\delta_{A,B} &=& |A \cap B| \,, \\
\nu_{A,B} &=& |(A \cup B)^c| \,,\end{aligned}$$ then this family of similarity measures for sets can be expressed as: $$\begin{aligned}
\label{eq:simfamily}
S(A,B) = \frac{t \Delta_{A,B} + u \delta_{A,B} + v \nu_{A,B}}{t' \Delta_{A,B} + u \delta_{A,B} + v \nu_{A,B}} \,,\end{aligned}$$ with $t$, $t'$, $u$ and $v$ four parameters. This family of similarity measures includes many well-known similarity measures for sets, such as the Jaccard coefficient [@Jaccard1908], the simple matching coefficient [@Sokal1958] and the Dice coefficient [@Dice1945].

Three members of this family are investigated in our experiments. The first one is the Jaccard coefficient, corresponding to $(t,t',u,v) = (0,1,1,0)$. The Jaccard coefficient is known to be $T_{\bf L}$-transitive. The second member that we investigate was originally proposed by [@Sokal1963]. It corresponds to $(t,t',u,v) = (0,1,2,2)$ and it does not satisfy $T_{\bf L}$-transitivity, which is considered as a very weak transitivity condition. Conversely, the third member that we analyse has rather strong transitivity properties. It is given by $(t,t',u,v) = (1,2,1,1)$ and it satisfies $T_{\bf P}$-transitivity.

Features and labels for all three members are generated as follows. First we generate 20-dimensional feature vectors consisting of statistically independent features that follow a Bernoulli distribution with $\pi=0.5$. Subsequently, the above-mentioned similarity measures are computed for each pair of features, resulting in a deterministic mapping between features and labels. Finally, to introduce some noise in the problem setting, 10% of the features are swapped in a last step from a zero to a one or vice versa. Figure \[fig:heatmaps\] illustrates the distribution of the obtained similarity scores for a 100 $\times$ 100 matrix.

![The distribution of similarity scores obtained on a 100 by 100 matrix for all three members of the family. From top to bottom: $(t,t',u,v) = (0,1,2,2)$, $(t,t',u,v) = (0,1,1,0)$ and $(t,t',u,v) = (1,2,1,1)$.[]{data-label="fig:heatmaps"}](simsInt.pdf "fig:")\
![The distribution of similarity scores obtained on a 100 by 100 matrix for all three members of the family. From top to bottom: $(t,t',u,v) = (0,1,2,2)$, $(t,t',u,v) = (0,1,1,0)$ and $(t,t',u,v) = (1,2,1,1)$.[]{data-label="fig:heatmaps"}](simsTL.pdf "fig:")\
![The distribution of similarity scores obtained on a 100 by 100 matrix for all three members of the family. From top to bottom: $(t,t',u,v) = (0,1,2,2)$, $(t,t',u,v) = (0,1,1,0)$ and $(t,t',u,v) = (1,2,1,1)$.[]{data-label="fig:heatmaps"}](simsTP.pdf "fig:")

In the experiments, we always generate three data sets, a training set for building the model, a validation set for hyperparameter selection, and a test set for performance evaluation. We perform two kinds of experiments. In the first experiment, we have a single set of $100$ nodes. $500$ node pairs are randomly sampled without replacement to the training, validation and test sets. Thus, the learning problem here is, given a subset of the relation values for a fixed set of nodes, to learn to predict missing relation values. This setup allows us to test also the Cartesian kernel, which is unable to generalize to completely new pairs of nodes. In the second experiment, we generate three separate sets of $100$ nodes for the training, validation and test sets, and sample from each of these $500$ edges. This experiment allows us to test the generalization capability of the learned models with respect to new couples of nodes (i.e., previously unseen nodes). Here, the Cartesian kernel is not applicable, and thus not included in the experiment. The experiments are repeated 100 times, the presented results are means over the repetitions. For statistical significance testing, we use the paired Wilcoxon-signed-rank test with significance level $0.05$. All pairs of kernels are compared, and the conservative Bonferroni correction is applied to take into account multiple hypothesis testing, meaning that the required p-value is divided by the number of comparisons. The Gaussian RBF kernel was considered at the node level. The used performance measure is the mean squared error (MSE). For training RLS we solve the corresponding system of linear equations using matrix factorization, by considering an explicit regularization parameter. A grid search is conducted to select the width of the Gaussian RBF kernel and the regularization parameter of the RLS algorithm. Both parameters are selected from the range $2^{-20}, \ldots, 2^1$.

  Setting                    $(t,t',u,v)$   MPRED    $K_{\otimes}^{\Phi}$   $K_{\otimes S}^{\Phi}$   $K_{\rm MLPK}^{\Phi}$   $K_{C}^{\Phi}$   $K_{C S}^{\Phi}$  
  ------------------------ -------------- --------- ---------------------- ------------------------ ----------------------- ---------------- ------------------ --
  Intransitive                  (0,1,2,2)  0.01038         0.00908                 0.00773                  0.00768             0.00989           0.00924       
  $T_{\bf L}$-transitive        (0,1,1,0)  0.01514         0.00962                 0.00781                  0.00805             0.01155           0.00941       
  $T_{\bf P}$-transitive        (1,2,1,1)  0.00259         0.00227                 0.00192                  0.00188             0.00248           0.00231       

  : The predictive performance on test data for the different types of relations and kernels. In this experiment, the task is to predict relation values for unknown edges in a partially observed relational graph. The performance measure is the mean squared error.[]{data-label="table:artificial1"}

  Setting                    $(t,t',u,v)$   MPRED    $K_{\otimes}^{\Phi}$   $K_{\otimes S}^{\Phi}$   $K_{\rm MLPK}^{\Phi}$  
  ------------------------ -------------- --------- ---------------------- ------------------------ ----------------------- --
  Intransitive                  (0,1,2,2)  0.01032         0.00995                 0.00936                  0.00971         
  $T_{\bf L}$-transitive        (0,1,1,0)  0.01515         0.01236                 0.01166                  0.01453         
  $T_{\bf P}$-transitive        (1,2,1,1)  0.00259         0.00251                 0.00236                  0.00242         

  : The predictive performance on test data for the different types of relations and kernels. In this experiment, the task is to predict relation values for a completely new set of nodes. The performance measure is the mean squared error.[]{data-label="table:artificial2"}

The results for the experiments are presented in Tables \[table:artificial1\] and \[table:artificial2\]. In both cases all the kernels outperform the mean as prediction, meaning that they are able to model the underlying relations. For all the learning methods, the error is lower in the first experiment than in the second one, demonstrating that it is easier to predict relations between known nodes, than to generalize to a new set of nodes. Enforcing symmetry is clearly beneficial, as the symmetric Kronecker product pairwise kernel always outperforms the standard Kronecker product pairwise kernel, and the symmetric Cartesian kernel always outperforms the standard one. Comparing the Kronecker and Cartesian kernels, the Kronecker one leads to clearly lower error rates. With the exception of the $T_{\bf L}$-transitive case in the second experiment, MLPK turns out to be highly successful in modeling the relations, probably due to enforcing symmetry of the learned relation. In the first experiment, all the differences are statistically significant, apart from the difference between the symmetric Kronecker product pairwise kernel and MLPK for the intransitive case. In the second experiment, all the differences are statistically significant. We can conclude that including prior knowledge about symmetry really helps boosting the predictive performance in this problem.

Learning the similarity between documents
-----------------------------------------

In the second experiment, we compare the ordinary and symmetric Kronecker pairwise kernels on a real-world data set based on newsgroups documents[^2]. The data is sampled from 4 newsgroups: rec.autos, rec.sport.baseball, comp.sys.ibm.pc.hardware and comp.windows.x. The aim is to learn to predict the similarity of two documents as measured by the number of common words they share. The node features correspond to the number of occurrences of a word in a document. Unlike the previous experiment, the feature representation is very high-dimensional and sparse, as there are more than $50000$ possible features, the majority of which are zero for any given document. First, we sample separate training, validation and test sets each consisting of $1000$ nodes. Second, we sample edges connecting the nodes in the training and validation set using exponentially growing sample sizes to measure the effect of sample size on the differences between the kernels. The sample size grid is $[ 100, 200, 400, \ldots ,102400 ]$. Again, we sample only edges with different starting and end nodes. When computing the test performance, we consider all the edges in the test set, except those starting and ending at the same node. The linear kernel is used at the node level. We train the RLS algorithm using conjugate gradient optimization with early stopping [@Pahikkala2010conditional], optimization is terminated once the MSE on the validation set has failed to decrease for 10 consecutive iterations. Since we rely on the regularizing effect of early stopping, a separate regularization parameter is not needed in this experiment. We do not include other types of kernels than the Kronecker product pairwise kernels in the experiment. To the best of our knowledge, no algorithms that scale to the considered experiment size exist for the other kernel functions. Hence, this experiment mainly aims to illustrate the computational advantages of the Kronecker product pairwise kernel. The mean as prediction achieves an MSE around $145$ on this dataset.

The results are presented in Figure \[fig:newsgroups\]. Even for $100$ pairs the errors are for both kernels much lower than the results for the mean as prediction, showing that the RLS algorithm succeeds with both kernels in learning the underlying relation. Increasing the training set size leads to a decrease in test error. Using the prior knowledge about the symmetry of the learned relation is clearly helpful. The symmetric kernel achieves for all sample sizes a lower error than the ordinary Kronecker product pairwise kernel and the largest differences are observed for the smallest sample sizes. For $100$ training instances, the error is almost halved by enforcing symmetry.

![The comparison of the ordinary Kronecker product pairwise kernel $K_{\otimes}^{\Phi}$ and the symmetric Kronecker product pairwise kernel $K_{\otimes S}^{\Phi}$ on the Newsgroups dataset. The mean squared error is shown as a function of the training set size.[]{data-label="fig:newsgroups"}](ngroups.pdf "fig:"){width="\linewidth"}\

Competition between species
---------------------------

In this final experiment we evaluate the performance of the ordinary and reciprocal Kronecker pairwise kernels and the metric learning pairwise kernel on simulated data from an ecological model. The setup is based on the one described in [@allesina2011competitive]. This model provides an elegant explanation for the coexistence of multiple species in the same habitat, a problem that has puzzled ecologists for decades [@hutchinson1961paradox].

Imagine $n$ species sharing a habitat and struggling for their share of the resources. One species can dominate another species based on $k$ so-called limiting factors. A limiting factor defines an attribute that can give a fitness advantage, for example in plants, such as the ability to photosynthesize, the ability to draw minerals from the soil, resistance to diseases, etc. Each species can score better or worse on each of its $k$ limiting factors. The degree to which one species can dominate a competitor is relative to the number of limiting factors for which it is superior. All possible interactions can thus be represented in a tournament. In this framework relations are reciprocal and often intransitive.

For this simulation 400 species were simulated with 10 limiting factors. The value of each limiting factor is for each species drawn from a random uniform distribution between 0 and 1. Thus, any species $v$ can be represented by a vector $\mathbf{f}$ of length $k$ with the limiting factors as elements. The probability that a species $v$ dominates species $v'$ can easily be calculated: $$Q(v,v')=\frac{1}{k}\sum_{i=1}^{k} H(f_i-f_i'), \label{lf}$$ where $H(x)$ is the Heaviside step function.

Of the 400 species, 200, 100 and 100 were used for generating training, validation and testing data. For each subset, the complete tournament matrix was determined using (\[lf\]). From those matrices 1200 interactions were sampled for training, 600 for model validation and 600 for testing. No combination of species was used more than once. Using the limiting factors as features, we try to regress the probability that one species dominates another one using the ordinary and reciprocal Kronecker product pairwise kernels and the metric learning pairwise kernel. Again, the Gaussian kernel is applied as the node kernel. The validation set is used to determine the optimal regularization parameter and kernel width parameter from the grids $ 2^{-20}$, $2^{-19}$ $\ldots$, $2^4$ and $2^{-10}$, $2^{-9}$ $\ldots$, $2^1$. To obtain statistically significant results the setup is repeated 100 times.\

  Kernel     MPRED    $K_{\otimes}^{\Phi}$   $K_{\otimes R}^{\Phi}$   $K_{\rm MLPK}^{\Phi}$  
  -------- --------- ---------------------- ------------------------ ----------------------- --
  MSE       0.02795         0.01082                 0.01067                  0.02877         

  : The predictive performance on test data for the different types of kernels. The performance measure is the mean squared error.[]{data-label="ecores"}

The results are shown in Table \[ecores\]. The Wilcoxon-signed-rank test with significance level 0.05 is used for significance testing, and a conservative Bonferroni correction is applied for multiple hypothesis testing. All differences are statistically significant.

The metric learning pairwise kernel gives rise to worse predictions than the mean as prediction. This is not surprising, as the MLPK cannot learn reciprocal relations. The ordinary Kronecker product pairwise kernel performs good and the reciprocal Kronecker product pairwise kernel performs even better. All the differences are statistically significant. The results show that using the information on the types of relations to be learned can boost the accuracy of the predictions.

Conclusion
==========

A general kernel-based framework for learning various types of graded relations was presented in this article. This framework extends existing approaches for learning relations, because it can handle crisp and graded relations. A Kronecker product feature mapping was proposed for combining the features of pairs of objects that constitute a relation (edge level in a graph), and it was shown that this mapping leads to a class of universal approximators, if an appropriate kernel is chosen on the object level (node level in a graph).

In addition, we clarified that domain knowledge about the relation to be learned can be easily incorporated in our framework, such as reciprocity and symmetry properties. Experimental results on synthetic and real-world data clearly demonstrate that this domain knowledge really helps in improving the generalization performance. Moreover, important links with recent developments in fuzzy set theory and decision theory can be established, by looking at transitivity properties of relations.

Acknowledgments {#acknowledgments .unnumbered}
===============

W.W. is supported as a postdoc by the Research Foundation of Flanders (FWO Vlaanderen) and T.P. by the Academy of Finland (grant 134020).

Appendix {#appendix .unnumbered}
========

Formal definitions
------------------

The Kronecker product of two matrices ${{\mathbf{M}}}$ and ${{\mathbf{N}}}$ is defined as $$\begin{aligned}
{{\mathbf{M}}}\otimes{{\mathbf{N}}}=\left(
\begin{array}{ccc}
{{{\mathbf{M}}}}_{1,1}{{\mathbf{N}}}&\cdots&{{\mathbf{M}}}_{1,n}{{\mathbf{N}}}\\
\vdots&\ddots&\vdots\\
{{{\mathbf{M}}}}_{m,1}{{\mathbf{N}}}&\cdots&{{\mathbf{M}}}_{m,n}{{\mathbf{N}}}\end{array}
\right),\end{aligned}$$

A continuous kernel ${K}$ on a compact metric space $\mathcal{V}$ (i.e. $\mathcal{V}$ is closed and bounded) is called universal if the RKHS induced by ${K}$ is dense in $C(\mathcal{V})$, where $C(\mathcal{V})$ is the space of all continuous functions $f : \mathcal{V} \rightarrow \mathbb{R}$. That is, for every function $f\in C(\mathcal{V})$ and every $\epsilon > 0$, there exists a set of input points $\{{v}_i \}_{i=1}^m \in \mathcal{V}$ and real numbers $\{\alpha_i\}_{i=1}^m$, with $m\in \mathbb{N}$, such that $$\max_{x\in \mathcal{V}}\left\{\left\arrowvert f({v})-\sum_{i=1}^m\alpha_i{K}({v}_i,{v})\right\arrowvert\right\}\leq\epsilon.$$ Accordingly, the hypothesis space induced by the kernel ${K}$ can approximate any function in $C(\mathcal{V})$ arbitrarily well, and hence it has the universal approximating property.

The following result is in the literature known as the Stone-Weierstra[ß]{} theorem (see e.g [@rudin1991functional]):

\[stoneweierstrass\] Let $\mathcal{V}$ be a compact metric space and let $C(\mathcal{V})$ be the set of real-valued continuous functions on $\mathcal{V}$. If $\mathcal{A}\subset C(\mathcal{V})$ is a subalgebra of $C(\mathcal{V})$, that is, $$\begin{array}{l}
\forall {f({v}),g({v})\in\mathcal{A}}, {r\in\mathbb{R}}:
{f({v})+rg({v})\in\mathcal{A}, f({v})g({v})\in\mathcal{A}}
\end{array}$$ and $\mathcal{A}$ separates points in $\mathcal{V}$, that is, $$\forall {v},{v}'\in\mathcal{V},{v}\neq {v}':\exists g\in\mathcal{A}:g({v})\neq g({v}'),$$ and $\mathcal{A}$ does not vanish at any point in $\mathcal{V}$, that is, $$\forall {v}\in\mathcal{V}:\exists g\in\mathcal{A}:g({v})\neq 0,$$ then $\mathcal{A}$ is dense in $C(\mathcal{V})$.

Proofs
------

([**Theorem \[unikrontheorem\]**]{}) Let us define $$\label{funckron}
\begin{array}{l}
\mathcal{A}\otimes\mathcal{A}
=\left\{t\mid t({v},{v}')=g({v})u({v}'),g,u\in \mathcal{A}\right\}
\end{array}$$ for a compact metric space $\mathcal{V}$ and a set of functions $\mathcal{A}\subset C(\mathcal{V})$. We observe that the RKHS of the kernel ${K}_{\otimes}^\Phi$ can be written as $\mathcal{H}\otimes\mathcal{H}$, where $\mathcal{H}$ is the RKHS of the kernel ${K}^\phi$.

Let $\epsilon>0$ and let $t\in C({\mathcal{V}})\otimes C({\mathcal{V}})$ be an arbitrary function which can, according to (\[funckron\]), be written as $t({v},{v}')=g({v})u({v}')$, where $g,u\in C({\mathcal{V}})$. By definition of the universality property, $\mathcal{H}$ is dense in $C({\mathcal{V}})$. Therefore, $\mathcal{H}$ contains functions $\overline{g},\overline{u}$ such that $$\max_{{v}\in{\mathcal{V}}}\left\{\left\arrowvert \overline{g}({v})-g({v})\right\arrowvert\right\}\leq \overline{\epsilon},\ \max_{{v}\in{\mathcal{V}}}\left\{\left\arrowvert \overline{u}({v})-u({v})\right\arrowvert\right\}\leq \overline{\epsilon} \,,$$ where $\overline{\epsilon}$ is a constant for which it holds that $$\max_{{v},{v}'\in{\mathcal{V}}}\left\{\left\arrowvert \overline{\epsilon} \, \overline{g}({v})\right\arrowvert+\left\arrowvert\overline{\epsilon} \,\overline{u}({v}')\right\arrowvert+\overline{\epsilon}^2\right\}\leq \epsilon \,.$$ Note that, according to the extreme value theorem, the maximum exists due to the compactness of ${\mathcal{V}}$ and the continuity of the functions $g$ and $u$. Now we have $$\begin{array}{l}
\displaystyle
\max_{{v},{v}'\in{\mathcal{V}}}\left\{\left\arrowvert t({v},{v}')-\overline{g}({v})\overline{u}({v}')\right\arrowvert\right\}\\
\displaystyle
\leq\max_{{v},{v}'\in{\mathcal{V}}}\left\{\left\arrowvert t({v},{v}')-g({v})u({v}')\right\arrowvert+\left\arrowvert \overline{\epsilon} \,\overline{g}({v})\right\arrowvert+\left\arrowvert\overline{\epsilon}\,\overline{u}({v}')\right\arrowvert+\overline{\epsilon}^2\right\}\\
\displaystyle
=\max_{{v},{v}'\in{\mathcal{V}}}\left\{\left\arrowvert \overline{\epsilon} \,\overline{g}({v})\right\arrowvert+\left\arrowvert\overline{\epsilon} \,\overline{u}({v}')\right\arrowvert+\overline{\epsilon}^2\right\}\\
\displaystyle\leq \epsilon,
\end{array}$$ which confirms the density of $\mathcal{H}\otimes\mathcal{H}$ in $C({\mathcal{V}})\otimes C({\mathcal{V}})$.

According to Tychonoff’s theorem, ${\mathcal{V}}^2$ is compact if ${\mathcal{V}}$ is compact. It is straightforward to see that $C({\mathcal{V}})\otimes C({\mathcal{V}})$ is a subalgebra of $C({\mathcal{V}}^2)$, it separates points in ${\mathcal{V}}^2$, it vanishes at no point of $C({\mathcal{V}}^2)$, and it is therefore dense in $C({\mathcal{V}}^2)$ due to Theorem \[stoneweierstrass\]. Consequently, $\mathcal{H}\otimes\mathcal{H}$ is also dense in $C({\mathcal{V}}^2)$, and ${K}_{\otimes}^\Phi$ is a universal kernel on ${\mathcal{E}}$.

([**Theorem \[antisymmetrictheorem\]**]{}) Let $\epsilon>0$ and $t\in R({\mathcal{V}}^2)$ be an arbitrary function. According to Theorem \[unikrontheorem\], the RKHS of the kernel ${K}_{\otimes}^\Phi$ defined in (\[eq:tppk\]) is dense in $C({\mathcal{V}}^2)$. Therefore, we can select a set of edges and real numbers $\{\alpha_i\}_{i=1}^m$, such that the function $$u({v},{v}')=\sum_{i=1}^m\alpha_i{K}^{\phi}({v},{v}_i) {K}^{\phi}({v}',{v}_i')$$ belonging to the RKHS of the kernel (\[eq:tppk\]) fulfills $$\label{tempapproxone}
\max_{({v},{v}')\in {\mathcal{V}}^2}\left\{\left\arrowvert t({v},{v}')-4u({v},{v}')\right\arrowvert\right\}\leq\frac{1}{2}\epsilon \,.$$ We observe that, because $t({v},{v}')=-t({v}',{v})$, the function $u$ also fulfills $$\max_{({v},{v}')\in {\mathcal{V}}^2}\left\{\left\arrowvert t({v},{v}')+4u({v}',{v})\right\arrowvert\right\}\leq\frac{1}{2}\epsilon$$ and hence $$\label{tempapproxthree}
\max_{({v},{v}')\in {\mathcal{V}}^2}\left\{\left\arrowvert 4u({v},{v}')+4u({v}',{v})\right\arrowvert\right\}\leq\epsilon \,.$$ Let $$\gamma({v},{v}')=2u({v},{v}')+2u({v}',{v}) \,.$$ Due to (\[tempapproxthree\]), we have $$\label{gammaineq}
\arrowvert\gamma({v},{v}')\arrowvert\leq\frac{1}{2}\epsilon,\phantom{\qed}\forall({v},{v}')\in{\mathcal{V}}^2 \,.$$ Now, let us consider the function ${h}({v},{v}')=$ $$\sum_{i=1}^m\alpha_i 2\left({K}^{\phi}({v},{v}_i) {K}^{\phi}({v}',{v}_i')-{K}^{\phi}({v}',{v}_i) {K}^{\phi}({v},{v}_i')\right) \,,$$ which is obtained from $u$ by replacing kernel (\[eq:tppk\]) with kernel (\[eq:recedgekernel\]). We observe that [ $$\begin{aligned}
{h}({v},{v}')&=&2u({v},{v}')-2u({v}',{v})\nonumber\\
&=&4u({v},{v}')-\gamma({v},{v}')\label{fgammaeq}.\end{aligned}$$ ]{} By combining (\[tempapproxone\]), (\[gammaineq\]) and (\[fgammaeq\]), we observe that the function ${h}$ fulfills (\[recclaim\]).

([**Proposition \[thm:mlpk\]**]{}) The model that we consider can be written as: $$Q({v},{v}') = \nabla \big((\phi({v}) - \phi({v}'))^T {\mathbf{W}} (\phi({v}) - \phi({v}')) \big) \,.$$ The connection with (\[eq:rrsym\]) then immediately follows by decomposing ${\mathbf{W}}$ as ${\mathbf{W}} = {\mathbf{U}}^T {\mathbf{U}}$ with ${\mathbf{U}}$ an arbitrary matrix. The specific case of $z=1$ is obtained when ${\mathbf{U}}$ can be written as a single-row matrix.

[^1]: Often the term fuzzy relation is used in the fuzzy set literature to refer to graded relations. However, fuzzy relations should be seen as a subclass of graded relations. For example, reciprocal relations should not be considered as fuzzy relations, because they often exhibit a probabilistic semantics rather than a fuzzy semantics.

[^2]: Available at: <http://people.csail.mit.edu/jrennie/20Newsgroups/>
