On the Learning of Quasimetrics

1 INTRODUCTION . Learned symmetrical metrics have been proven useful for innumerable tasks including dimensionality reduction ( Tenenbaum et al. , 2000 ) , clustering ( Xing et al. , 2002 ) , classification ( Weinberger et al. , 2006 ; Hoffer & Ailon , 2015 ) , and information retrieval ( Wang et al. , 2014 ) . However , the real world is largely asymmetrical , and symmetrical metrics can only capture a small fraction of it . Generalizing metrics , quasimetrics ( Defn . 2.1 ) allow for asymmetrical distances and can be found in a wide range of domains ( see Fig . 1 ) . Ubiquitous physical forces , such as gravity and wind , as well as human-defined rules , such as one-way roads , make the traveling time between places a quasimetric . Furthermore , many of our social artifacts are directed graphs— genealogy charts , follow-relation on Twitter ( Leskovec & Krevl , 2014 ) , citation graphs ( Price , 2011 ) , hyperlinks over the Internet , etc . Shortest paths on these graphs naturally induce quasimetric spaces . In fact , we can generalize to Markov Decision Processes ( MDPs ) and observe that optimal goal-reaching plan costs ( i.e. , universal value/Q-functions ( Schaul et al. , 2015 ; Sutton et al. , 2011 ) ) always form a quasimetric ( Bertsekas & Tsitsiklis , 1991 ; Tian et al. , 2020 ) . Moving onto more abstract structures , quasimetrics can also be found as expected hitting times in Markov chains , and as conditional Shannon entropy H ( · | · ) in information theory . ( See the appendix for proofs and discussions of these quasimetrics . ) In this work , we study the task of quasimetric learning . Given a sampled training set of pairs and their quasimetric distances , we ask : how well can we learn a quasimetric that fits the training data ? We define quasimetric learning in analogy to metric learning : whereas metric learning is the problem of learning a metric function , quasimetric learning is the problem of learning a quasimetric function . This may involve searching over a hypothesis space constrained to only include quasimetric functions ( which is what our method does ) or it could involve searching for approximately quasimetric functions ( we compare to and analyze such approaches ) . Successful formulations have many potential applications , such as good structural priors in reinforcement learning ( Schaul et al. , 2015 ; Tian et al. , 2020 ) , graph learning ( Rizi et al. , 2018 ) and causal relation learning ( Balashankar & Subramanian , 2021 ) . Towards this goal , our contributions are • We study the quasimetric learning task with two goals : ( 1 ) fitting training data well and ( 2 ) respecting quasimetric constraints ( Sec . 3 ) ; • We prove that a large family of algorithms , including unconstrained networks trained in the Neural Tangent Kernel ( NTK ) regime ( Jacot et al. , 2018 ) , fail at this task , while a learned embedding into a latent quasimetric space can potentially succeed ( Sec . 4 ) ; • We propose Poisson Quasimetric Embeddings ( PQEs ) , the first quasimetric embedding formulation learnable with gradient-based optimization , with strong theoretical guarantees ( Sec . 5 ) ; • Our experiments complement the theory and demonstrate the benefits of PQEs on random graphs , social graphs and offline Q-learning ( Sec . 6 ) . 2 PRELIMINARIES ON QUASIMETRICS AND POISSON PROCESSES . Quasimetric space is a generalization of metric space where all requirements of metrics are satisfied , except that the distances can be asymmetrical . Definition 2.1 ( Quasimetric Space ) . A quasimetric space is a pair ( X , d ) , where X is a set of points and d : X × X → [ 0 , ∞ ] is the quasimetric , satisfying the following conditions : ∀x , y ∈ X , x = y ⇐⇒ d ( x , y ) = 0 , ( Identity of Indiscernibles ) ∀x , y , z ∈ X , d ( x , y ) + d ( y , z ) ≥ d ( x , z ) . ( Triangle Inequality ) Being asymmetric , quasimetrics are often thought of as ( shortest-path ) distances of some ( possibly infinite ) weighted directed graph . A natural way to quantify the complexity of a quasimetric is to consider that of its underlying graph . Quasimetric treewidth is an instantiation of this idea . Definition 2.2 ( Treewidth of Quasimetric Spaces ( Mémoli et al. , 2018 ) ) . Consider a quasimetric space M as shortest-path distances on a positively-weighted directed graph . Treewidth of M is the minimum over all such graphs ’ treewidths . Poisson processes are commonly used to model events ( or points ) randomly occurring across a set A ( Kingman , 2005 ) , e.g. , raindrops hitting a windshield , photons captured by a camera . The number of such events within a subset of A is modeled as Poisson distribution , whose mean is given by a measure µ of A that determines how “ frequently the events happen at each location ” . Definition 2.3 ( Poisson Process ) . For nonatomic measure µ on set A , a Poisson process on A with mean measure µ is a random countable subset P ⊂ A ( i.e. , the random events / points ) such that • for any disjoint measurable subsets A1 , . . . , An of A , the random variables N ( A1 ) , . . . , N ( An ) are independent , where N ( B ) , # { P ∩B } is the number of points of P in B , and • N ( B ) has the Poisson distribution with mean µ ( B ) , denoted as Pois ( µ ( B ) ) . Fact 2.4 ( Differentiability of P [ N ( A1 ) ≤ N ( A2 ) ] ) . For two measurable subsets A1 , A2 , P [ N ( A1 ) ≤ N ( A2 ) ] = P [ Pois ( µ ( A1 \A2 ) ) ≤ Pois ( µ ( A2 \A1 ) ) ︸ ︷︷ ︸ two independent Poissons ] . ( 1 ) Furthermore , for independent X ∼ Pois ( µ1 ) , Y ∼ Pois ( µ2 ) is differentiable w.r.t . µ1 and µ2 . In the special case where µ1 or µ2 is zero , we can simply compute P [ X ≤ Y ] = { P [ 0 ≤ Y ] = 1 if µ1 = 0 P [ X ≤ 0 ] = P [ X = 0 ] = e−µ1 if µ2 = 0 ( Pois ( 0 ) is always 0 ) = exp ( − ( µ1 − µ2 ) + ) , ( 2 ) where x+ , max ( 0 , x ) . In general , this probability and its gradients can be obtained via a connection to noncentral χ2 distribution ( Johnson , 1959 ) , which we overview and derive formulas in the appendix . Therefore , if A1 and A2 are parametrized by some θ such that µ ( A1 \ A2 ) and µ ( A2 \ A1 ) are differentiable w.r.t . θ , so is P [ N ( A1 ) ≤ N ( A2 ) ] . a b c : Train : Test Triangle inequality =⇒ ? ≤ d ( a , b ) + d ( b , c ) = 31 ? ≥ d ( a , b ) − d ( c , b ) = 28 0 0 029 2 1 11 ? 0 20 40 60 80 100 Count Unconstrained Network ( Training MSE = 0.02 ± 0.06 ) 0 10 20 30 Valid Range 0 20 40 60 80 100 Euclidean Space Embedding ( Training MSE = 58.83 ± 0.00 ) 0 10 20 30 0 20 40 60 80 100 Poisson Quasimetric Embedding ( Training MSE = 0.02 ± 0.07 ) 0 10 20 30 Figure 2 : Quasimetric learning on a 3-element space . Leftmost : Training set contains all pairs except for ( a , c ) . Arrow labels show quasimetric distances ( rather than edge weights ) . A quasimetric d̂ should predict d̂ ( a , c ) ∈ [ 28 , 30 ] . Right three : Different formulations are trained to fit training pairs distances , and then predict on the test pair . Plots show distribution of the prediction over 100 runs . 3 QUASIMETRIC LEARNING . Consider a quasimetric space ( X , d ) . The quasimetric learning task aims to infer a quasimetric from observing a training set { ( xi , yi , d ( xi , yi ) ) } i ⊂ X × X × [ 0 , ∞ ] . Naturally , our goals for a learned predictor d̂ : X × X → R are : respecting the quasimetric constraints and fitting training distances . Crucially , we are not simply aiming for the usual sense of generalization , i.e. , low population error . Knowing that true distances have a quasimetric structure , we can better evaluate predictors and desire ones that fit the training data and are ( approximately ) quasimetrics . These objectives also indirectly capture generalization because a predictor failing either requirement must have large error on some pairs , whose true distances follow quasimetric constraints . We formalize this relation in Thm . 4.6 . 3.1 LEARNING ALGORITHMS AND MODEL CLASSES . Ideally , the learning should scale well with data , potentially generalize to unseen samples , and support integration with other deep learning systems ( e.g. , via differentiation ) . One option is to simply learn a generic function approximator that takes in ( x , y ) ∈ X × X ( as a concatenated input ) and outputs a scalar as the prediction of the pair ’ s distance , or some transformed version of it ( e.g. , log distance ) . This approach has been adopted by the community in learning graph distances ( Rizi et al. , 2018 ) and plan costs in MDPs ( Tian et al. , 2020 ) . When the function approximator is a deep neural network , we refer to such formulations as unconstrained ( deep neural ) networks . While deep networks are known to fit training data well ( Jacot et al. , 2018 ) , in this paper we also investigate whether they learn to be ( approximately ) quasimetrics . Alternatively , we can encode each input to a latent space , where a bivariate function outputs the distance prediction . When the function is a latent metric , we obtain metric embeddings . Our proposed Poisson Quasimetric Embedding ( PQE ) ( specified in Sec . 5 ) is also of this kind , where the function is a differentiable latent quasimetric that can approximate arbitrary quasimetrics in data space . 3.2 A TOY EXAMPLE . To build up intuition on how various models perform according to our two goals , we consider a toy quasimetric space with only 3 elements in Fig . 2 . The space has a total of 9 pairs , from which we use 8 as the training set . Due to quasimetric requirements ( esp . triangle inequality ) , knowing distances of these 8 pairs restricts valid values for the heldout pair to a particular range ( which is [ 28 , 31 ] in this case ) . If a model approximates 8 training pairs well and respects quasimetric constraints well , its prediction on that heldout pair should fall into this range . We train three models w.r.t . mean squared error ( MSE ) over the training set using gradient descent : • Unconstrained deep network that predicts distance , • Metric embedding into a latent Euclidean space with a deep encoder , • Quasimetric embedding into a latent PQE space with a deep encoder ( our method ) . ( Details of Poisson Quasimetric Embedding ( PQE ) are explained later in Sec . 5 . ) The three approaches exhibit interesting qualitative differences . Euclidean embedding , unable to model asymmetries in training data , fails to attain a low training error . While both other methods approximate training distances well , unconstrained networks greatly violate quasimetric constraints ; only PQEs respect the constraints and consistently predicts within the valid range . Here , the structural prior of embedding into a quasimetric latent space appears important to successful learning . Without any such prior , unconstrained networks fail badly . In the next section , we present a rigorous theoretical study of the quasimetric learning task , which confirms this intuition .

Summary: This paper considers the problem of learning Quasi-metrics. A quasi-metric is a non-negative function of two variables that satisfies the triangle inequality and that d(x,y) = 0 <=> x=y. Unlike metrics it does not satisfy triangle inequality.  In this paper, the authors define the quasi-metric learning problem. They then proceed to show that algorithms invariant to orthogonal transforms (in a sense they define - such that it includes unconstrained multi-layer perceptron) can not learn transforms satisfy the quasimetric constraints with probability at least 1/2 - o(1). They then define a program called Poisson Quasimetric Embeddings (PQEs) to learn quasimetrics - which come in two related flavours. They conclude with empirical evaluation of PQE and a variety of algorithms.