Classification from Triplet Comparison Data

Learning from triplet comparison data has been extensively studied in the context of metric learning, where we want to learn a distance metric between two instances, and ordinal embedding, where we want to learn an embedding in a Euclidean space of the given instances that preserve the comparison order as much as possible. Unlike fully labeled data, triplet comparison data can be collected in a more accurate and human-friendly way. Although learning from triplet comparison data has been considered in many applications, an important fundamental question of whether we can learn a classifier only from triplet comparison data without all the labels has remained unanswered. In this letter, we give a positive answer to this important question by proposing an unbiased estimator for the classification risk under the empirical risk minimization framework. Since the proposed method is based on the empirical risk minimization framework, it inherently has the advantage that any surrogate loss function and any model, including neural networks, can be easily applied. Furthermore, we theoretically establish an estimation error bound for the proposed empirical risk minimizer. Finally, we provide experimental results to show that our method empirically works well and outperforms various baseline methods.


Introduction
Recently, learning from comparison-feedback data has received increasing attention (Heim, 2016;Kleindeßner, 2017). It is usually argued that humans perform better in the task of evaluating which instances are similar, rather than identifying each individual instance (Stewart et al., 2005). It is also argued that humans can achieve much better and more reliable performance on assessing the similarity on a relative scale ("Instance A is more similar to instance B than to instance C") rather than on an absolute scale ("The similarity score between A and B is 0.9 while the one between A and C is 0.4") (Kleindeßner, 2017). Collecting data in this manner has the advantage of avoiding the problem caused by individuals' different assessment scales. On the other hand, the collected absolute similarity scores may only provide information on a comparison level in some applications, e.g., sensor localization (Liu et al., 2004). It was shown that keeping only the relative comparison information can help an algorithm be resilient against measurement errors and achieve high accuracy (Xiao et al., 2006).
In this paper, we focus on the problem of learning from triplet comparison data, which is a common form of comparison-feedback data. A triplet comparison (x a , x b , x c ) contains the information that instance x a is more similar to x b than to x c . As one example, search-engine query logs can readily provide feedback in the form of triplet comparisons (Schultz and Joachims, 2004). Given a list of website links {A, B, C} for a query, if links A and B are clicked and the link C is not clicked, we can formulate a triplet comparison as (A, B, C).
Learning from triplet comparison data was initially studied in the context of metric learning (Schultz and Joachims, 2004), in which a consistent distance metric between two instances is assumed to be learned from data. The well-known triplet loss for face recognition was proposed in this line of research (Schroff et al., 2015;Yu et al., 2018).
Using this loss function, an inductive mapping function can be efficiently learned from triplet comparison image data. At the same time, the problem of ordinal embedding has also been extensively studied (Agarwal et al., 2007;Van Der Maaten and Weinberger, 2012). It aims to learn an embedding of the given instances to the Euclidean space that preserves the order given by the data. Algorithms for large scale ordinal embedding have been developed (Anderton and Aslam, 2019). In addition, many other problem settings have been considered for the situation of using only triplet comparison data, such as nearest neighbor search (Haghiri et al., 2017), kernel function construction  and outlier identification .
However, learning a binary classifier from triplet comparison data remained untouched until recently. A random forest construction algorithm (Haghiri et al., 2018) was proposed for both classification and regression. However, it first requires a labeled dataset and needs to actively access a triplet comparison oracle many times. For passively collected triplet comparison data, a boosting based algorithm (Perrot and von Luxburg, 2018) was recently proposed without accessing a triplet comparison oracle. However, a set of labeled data is still indispensable to initiating the training process. To the best of our knowledge, this paper is the first to tackle the problem of learning a classifier only from passively obtained triplet comparison data, without accessing either a labeled dataset or an oracle.

Contributions:
We show that we can learn a binary classifier from only passively obtained triplet comparison data. We achieve this goal by developping a novel method for learning a binary classifier in this setting with theoretical justification. We use the direct risk minimization framework given for the classification problem. We then show that the classification risk can be empirically estimated in an unbiased way given only triplet comparison data. Theoretically, we establish an estimation error bound for the proposed empirical risk minimizer, showing that learning from triplet comparison data is consistent. Our method also returns an inductive model, which is different from clustering and ordinal embedding, and can be applied to unseen test data points. The test data would consist of single instances instead of triplet comparisons since our primitive goal is to perform a binary classification task on unseen data points.
In summary, for the problem of classification using only triplet comparison data, our contributions in this paper are three-fold: • We propose an empirical risk minimization method for binary classification us-ing only passively obtained triplet comparison data, which gives us an inductive classifier.
• We theoretically establish an estimation error bound for our method, showing that the learning is consistent.
• We experimentally demonstrate the practical usefulness of our method.

Related Work
Our problem setting of learning a binary classifier from passively obtained triplet comparison data can be considered as a type of a weakly-supervised classification problem, where we do not have access to ground-truth labels (Zhou, 2017).
An approach based on constructing an unbiased risk estimator of the true classification risk from weakly-supervised data has been explored in many problem settings; for example, positive-unlabeled classification (du Plessis et al., 2014;Niu et al., 2016) and similarity-unlabeled classification (Bao et al., 2018) can be handled by the framework of learning from two sets of unlabeled data (Lu et al., 2018). Nevertheless, our problem setting is not a special case addressed by Lu et al. (2018) since we have only one set of triplet comparison data. We later show that we can formulate three different distributions, which is fundamentally different from the framework used by Lu et al. (2018).
Moreover, our problem setting is also different from similarity-dissimilarity-unlabeled classification (Shimada et al., 2019) in the sense that we have no access to unlabeled data and similarity and dissimilarity pairs, but only triplet comparison information. Fur-thermore, it is important to note that our problem setting is also different from preference learning (Fürnkranz and Hüllermeier, 2010), since we do not want to learn a ranking function but construct a binary classifier. Although we can first learn a ranking function and then decide a proper threshold to construct a binary classifier (Narasimhan and Agarwal, 2013), it is not straightforward to choose a proper threshold. Therefore, instead of this two-stage method, we focus on a method that can directly learn a binary classifier from triplet comparison data.

Learning A Classifier from Triplet Comparison Data
In this section, we first review the ordinary fully supervised classification setting. Then we introduce the problem setting and assumption for the data generation process of triplet comparison data. Finally, we describe the proposed method for training a binary classifier from only passively obtained triplet comparison data.

Preliminary
We first briefly introduce the traditional binary classification problem. We denote X ⊂ R d as a d-dimensional sample space and Y = {+1, −1} as a binary label space. In the fully supervised setting, we usually assume the labeled data (x, y) ∈ X × Y are drawn from the joint probability distribution with density p(x, y) (Vapnik, 1995). The goal is to obtain a classifier f : X → R that minimizes the classification risk where the expectation is over the joint density p(x, y) and ℓ : R × Y → R + is a loss function that measures how well the classifier estimates the true class label.
In the traditional fully supervised classification setting, we are given both positive and negative training data collectively drawn from the joint density p(x, y). However, in our case, we still want to train a binary classifier that minimizes the classification risk, although we do not have fully labeled data.

Generation Process of Triplet Comparison Data
We formulate the underlying generation process of triplet comparison data in order to perform empirical risk minimization. Three samples in a triplet are first generated independently, then shown to a user. The user can mark the triplet to be proper or not. A proper triplet means that the similarity between the first and second samples is stronger or the same as the similarity between the first and third samples. Specifically, it means that three labels (y a , y b , y c ) in a triplet appear to be one of the following cases: Otherwise, it means the first sample is more similar to the third sample than to the second sample; thus, the user chooses to mark the triplet as not proper. Similarly, it means (y a , y b , y c ) appears to be one of the following cases First, three data samples are generated independently from the underlying joint density p(x, y), then D = {(x a , x b , x c )} are collected without knowing the underlying true labels (y a , y b , y c ). However, we can collect information about which case a triplet belongs to from user feedback. After receiving feedback from users, we can actually obtain two distinct datasets. The data the user chooses to keep the order is denoted as Similarly, the data the user chooses to flip the order is denoted as Note that the ratio of n 1 |D 1 | to n 2 |D 2 | is fixed because we assume the three samples in a triplet are generated independently from p(x, y); thus, the ratio n 1 n 2 is only dependent on the underlying class prior probabilities, which are fixed unknown values.
The two datasets can be considered to be generated from two underlying distributions as indicated by the following lemma.
We denote the pointwise data collected from D 1 and D 2 by ignoring the triplet , the marginal densities of which can be expressed by the following theorem.
Theorem 1. Samples in D 1,a , D 1,c , D 2,a and D 2,c are independently drawn from and samples in D 2,b are independently drawn from A proof is given in Appendix B.
Theorem 1 indicates that from triplet comparison data, we can essentially obtain samples that can be drawn independently from three different distributions. We denote the three aggregated datasets as

Unbiased Risk Estimator for Triplet Comparison Data
We now attempt to express the classification risk, on the basis of the three pointwise densities presented in Section 3.2.
The classification risk can be separately expressed as the expectations over p + (x) and p − (x). Although we do not have access to data drawn from these two distributions, we can obtain data from three related densitiesp 1 (x),p 2 (x), andp 3 (x) as indicated in Theorem 1. Letting we can express the relationship between these densities as Our goal is to solve the above equation so that we can express p + (x) and p − (x) in terms of the three densities from which we have i.i.d. data samples. To this end, we can rewrite the classification risk, which we want to minimize, in terms ofp 1 (x),p 2 (x) and p 3 (x). An answer to Eq. (8) is given by the following lemma.
Detailed derivation is given in Appendix C.
As a result of the above lemma, we can express the classification risk using only triplet comparison data. Letting ℓ + (x) ℓ(f (x), +1) and ℓ − (x) ℓ(f (x), −1), we have the following theorem.
Theorem 2. The classification risk can be equivalently expressed as where π test p test (y = +1) denotes the class prior of the test dataset.
A proof is given in Appendix D.
In this paper, we consider the common case in which π test = π + , which means the test dataset shares the same class prior as the training dataset. However, even when π test = π + , which means the class prior shift (Sugiyama, 2012) occurs, our method can still be used when π test is known.

Estimation Error Bound
In this section, we establish an estimation error bound for the proposed unbiased risk estimator. Let F ⊂ R X represent a function class specified by a model. First, let R(F ) be the (expected) Rademacher complexity of F which is defined as where n is a positive integer, Z 1 , · · · , Z n are i.i.d. random variables drawn from a probability distribution with density µ, and σ = (σ 1 , · · · , σ n ) are Rademacher variables, which are random variables that take the value of +1 or −1 with even probabilities.
We assume for any probability density µ, the specified model F satisfies R(F ) ≤ Then for any δ > 0, with probability at least 1 − δ: where A proof is given in Appendix E.
Since n appears in the denominator, it is obvious that when the class prior is fixed, the bound will get tighter as the amount of triplet comparison data increases. However, it is not clear how the bound will behave when we fix the amount of triplet comparison data and change the class prior. Thus in Figure 1, we show the behavior of the coefficient term C R |ac−b 2 | with respect to the same class prior of both training and test datasets.
From the illustration, we can capture the rough trend that the bound gets tighter when the class prior becomes further from 0.5. We will further investigate this behavior in experiments.

On Class Prior
In the previous sections, the class prior π + is assumed known. For this simple case, we can directly use the proposed algorithm to separate test data as well as identify correct classes. However, it may not be true for many real-world applications. There are two situations that can be considered. For the worst case, no information about the class prior is given. Although we still can estimate a result for the class prior from data and obtain a classifier that is able to separate data for different classes, we cannot identify the correct class without the information of which class has a higher class prior. A better situation is that we have the information of which class has a higher class prior.
By setting this class as the positive class, we can successfully train a classifier to identify the correct class. Thus, we assume that the positive class has a higher class prior, which means π + > 1 2 .

Experiments
In this section, we conducted experiments using real world datasets to evaluate and investigate the performance of the proposed method for triplet classification.
6.1 Baseline methods KMEANS: As a simple baseline, we used k-means clustering (Macqueen, 1967) with k = 2 on all the data instances of triplets while ignoring all the relation information.
ITML: Information-theoretic metric learning (Davis et al., 2007) is a metric learning method that requires pairwise the relationship between data instances. From a triplet (x a , x b , x c ), we constructed pairwise constraints as (x a , x b ) being similar and (x a , x c ) being dissimilar. Using the metric returned by the algorithm, we conducted k-means clustering on test data. We used the identity matrix for prior knowledge and fix the slack variable as γ = 1.
TL: Triplet loss (Schroff et al., 2015) is a loss function proposed in the context of deep metric learning which can learn a metric directly from triplet comparison data.
Using the metric returned by the algorithm, we conducted k-means clustering on test data.
SERAPH: Semi-supervised metric learning paradigm with hyper sparsity ) is a metric learning method based on entropy regularization. We formulated a pairwise relationship in the same manner as with ITML. Using the metric returned by ITML, we conducted k-means clustering on test data.
SU: SU learning (Bao et al., 2018) is a method for learning a binary classifier from similarity and unlabeled data. We used the same method for estimating the class prior, and considered the less similar sample in a triplet as unlabeled data.

Datasets
UCI datasets: We used six datasets from the UCI Machine Learning Repository (Asuncion and Newman, 2007). They are binary classification datasets and we use the given labels for further triplet comparison data generation.
Image datasets: We used the following three image datasets.

Proposed method
For the proposed method, we used a fully-connected neural network with only 1 hidden layer of width 100 and rectified linear units (ReLUs) (Nair and Hinton, 2010) for all the datasets except for CIFAR-10. The width of the hidden layer was set to be 100 through out all experiments. Adam (Kingma and Ba, 2014) was used for optimization.
The neural network architecture used for CIFAR-10 is specified in Appendix.

Results
The proposed method estimates the unknown class prior first. For baseline methods, performances are measured by the clustering accuracy 1 − min(r, 1 − r) where r is the error rate. The results of different triplet numbers are listed in Tables 1, 2,and 3.
The best and equivalent methods are shown in bold face on the one-sided t-test with a significance level of 5%. Also as shown in Figure 2, the performance of the proposed method with respect to the class prior and the size of training dataset followed the prediction by the theory in most of the cases.

Conclusion
In this paper, we proposed a novel method for learning a classifier from only passively obtained triplet comparison data. We established an estimation error bound for the proposed method, and confirmed that the estimation error decreases as the amount of triplet comparison data increases. We also empirically confirmed that the performance of the proposed method surpassed multiple baseline methods on various datasets. For future work, it would be interesting to investigate alternative methods that can handle a   Proof. From the data generation process, we can consider the generation distribution for data of D 1 as Note that the denominator in Eq. (15) can be rewritten as then we have Moreover, the distribution p(x a , x b , x c , (y a , y b , y c ) ∈ Y 1 ) at the numerator of Eq. (17) can be explicitly expressed as from the assumption that three instances in each triplet comparison is generated independently.
Similarly, the underlying density for data of D 2 can be expressed as

B Proof of Theorem 1
Proof. For simplicity, we give the proof of D 2,a and the other 5 cases follow the similar proof. Noticing p 2 (x a , x b , x c ) = π + p + (x a )p − (x b )p + (x c ) + π − p − (x a )p + (x b )p − (x c ).
In order to decompose the triplet comparison data distribution into pointwise distribution, we marginalize p 2 (x a , x b , x c ) with respect to x b and x c : C Proof of Lemma 2 Proof. Notice that the equation has an infinite number of solutions. Letting we resort to finding the Moore-Penrose pseudo inverse (Moore, 1920;Penrose and Todd, 1954), which provides the minimum Euclidean norm solution to the above system of linear equations.
Let T * denote the conjugate transpose. We have