For probabilistic classification, the most popular loss is arguably the (multinomial) logistic loss. It is smooth, enabling fast convergence rates, and the softmax operator provides a consistent mapping to probability distributions. In many applications, different costs are associated to mis-classification errors between classes. While a cost-aware generalization of the logistic loss exists (Gimpel & Smith, 2010), it does not provide a cost-aware counterpart of the softmax. The softmax is pointwise by nature: it is oblivious to misclassification costs or to the geometry of classes.
Optimal transport (Wasserstein) losses have recently gained popularity in machine learning, for their ability to compare probability distributions in a geometrically faithful manner, with applications such as classification (Kusner et al., 2015), clustering (Cuturi & Doucet, 2014), domain adaptation (Courty et al., 2017), dictionary learning (Ro- let et al., 2016) and generative models training (Montavon et al., 2016; Arjovsky et al., 2017). For probabilistic clas-sification, Frogner et al. (2015) proposes to use entropy-regularized optimal transport (Cuturi, 2013) in the multi-label setting. Although this approach successfully leverages a cost between classes, it results in a non-convex loss, when combined with a softmax. A similar regularized Wasserstein loss is used by Luise et al. (2018) in conjunction with a kernel ridge regression procedure (Ciliberto et al., 2016) in order to obtain a consistency result.
The relation between the logistic loss and the maximum entropy principle is well-known. Building upon a generalization of the Shannon entropy originating from entropy regularized optimal transport (Feydy et al., 2019) and Fenchel duality between measures and continuous functions, we propose a generalization of the logistic loss that takes into account a metric or cost between classes. Unlike previous attempts to use optimal transport distances for learning, our loss is convex, and naturally defines a geometric generalization of the softmax operator. Besides providing novel insights in the logistic loss, our loss is theoretically sound, even when learning and predicting continuous probability distributions over a potentially infinite number of classes. To sum up, our contributions are as follows.
Organization and contributions.
• We introduce the distribution learning setting, review existings losses leveraging a cost between classes and point out their shortcomings (2).
• Building upon entropy-regularized optimal transport, we present a novel cost-sensitive distributional learning loss and its corresponding softmax operator. Our proposal is theoretically sound even in continuous measure spaces (3).
• We study the theoretical properties of our loss, such as its Fisher consistency (4). We derive tractable methods to compute and minimize it in the discrete distribution setting. We propose an abstract Frank-Wolfe scheme for computations in the continuous setting.
• Finally, we demonstrate its effectiveness on two discrete prediction tasks involving a geometric cost: ordinal regression and drawing generation using VAEs (5).
Notation. We denote X a finite or infinite input space, and Y a compact potentially infinite output space. When Y is a finite set of d classes, we write . We denote
and
the sets of continuous (bounded) functions, Radon (positive) measures and probability measures on Y. Note that in finite dimensions,
is the probability simplex and
. We write vectors in
and continuous functions in C(Y) with small normal letters, e.g., f, g. In the finite setting, where
, we define
. We write elements of
and measures in M(Y) with greek letters
. We write matrices and operators with capital letters, e.g., C. We denote by
and
the tensor product and sum, and
the scalar product.
In this section, after introducing distributional learning in a discrete setting, we review two lines of work for taking into account a cost C between classes: cost-augmented losses, and geometric losses based on Wasserstein and energy distances. Their shortcomings motivate the introduction of a new geometric loss in 3.
2.1. Discrete distribution prediction and learning
We consider a general predictive setting in which an input vector is fed to a parametrized model
(e.g., a neural network), that predicts a score vector f =
. At test time, that vector is used to predict the most likely class
. In order to predict a probability distribution
, it is common to compose
with a link function
, where
. A typical example of link function is the softmax.
To learn the model parameters , it is necessary to de-fine a loss
between a ground-truth
and the score vector
. Composite losses (Reid & Williamson, 2010; Williamson et al., 2016) decompose that loss into a loss
, where
and
. Note that depending on
and
is not necessarily convex in f. More recently, Blon- del et al. (2018; 2019) introduced Fenchel-Young losses, a generic way to directly construct a loss
and a corresponding link
. We will revisit and generalize that framework to the continuous output setting in the sequel of this paper. Given a loss
and a training set of input-distribution pairs,
, where
and
, we then minimize
, potentially with regularization on
.
2.2. Cost-augmented losses
Before introducing a new geometric cost-sensitive loss in 3, let us now review classical existing cost-sensitive loss functions. Let C be a
matrix, such that
is the cost of misclassifying class
as class
. We assume
for all
. To take into account the cost C, in the single label setting, it is natural to define a loss
as follows
To obtain a loss , we simply define
, where
is the one-hot representation of
. Note that choosing
when
and
otherwise (i.e.,
) reduces to the zero-one loss. To obtain a convex upper-bound, (1) is typically replaced with a cost-augmented hinge loss (Crammer & Singer, 2001; Tsochantaridis et al., 2005):
Replacing the max above with a log-sum-exp leads to a cost-augmented version of the logistic (or conditional random field) loss (Gimpel & Smith, 2010). Another convex relaxation is the cost-sensitive pairwise hinge loss (Weston & Watkins, 1999; Duchi et al., 2018). Remarkably, all these losses use only one row of C, the one corresponding to the ground truth y. Because of this dependency on y, it is not clear how to define a probabilistic mapping at test time. In this paper, we propose a loss which comes with a geometric generalization of the softmax operator. That operator uses the entire cost matrix C.
2.3. Wasserstein and energy distance losses
Wasserstein or optimal transport distances recently gained popularity as a loss in machine learning for their ability to compare probability distributions in a geometrically faithful manner. As a representative application, Frogner et al. (2015) proposed to use entropy-regularized optimal transport (Cuturi, 2013) for cost-sensitive multi-label classifica-tion. Effectively, optimal transport lifts a distance or cost to a distance between probability distributions over Y. Following Genevay et al. (2016), given a ground-truth probability distribution
and a predicted probability distribution
, we define
where U is the transportation polytope, a subset of whose elements
have constrained marginals:
and
. KL is the Kullback–Leibler divergence (a.k.a. relative entropy). Because
needs to be a valid probability distribution, Frogner et al. (2015) propose to use
softmax(f), where
is a vector of prediction scores. Unfortunately, the resulting composite loss,
OT
softmax(f)), is not convex w.r.t. f. Another class of divergences between measures
and
stems from energy distances (Sz´ekely & Rizzo, 2013) and maximum mean discrepancies. However, composing these divergences with a softmax again breaks convexity in f. In contrast, our proposal is convex in f and defines a natural geometric softmax.
In this section, we construct a loss between probability measures and score functions, canonically associated with a link function. Our construction takes into account a cost function between classes. Unlike existing methods reviewed in
2.2, our loss is well defined and convex on compact, possibly infinite spaces Y. We start by extending the setting of
2.1 to predicting arbitrary probabilities, for instance having continuous densities with respect to the Lebesgue measure or singular distributions supported on curves or surfaces.
3.1. Continuous probabilities and score functions
We consider a compact metric space of outputs Y, endowed with a symmetric cost function . We wish to predict probabilities over Y, that is, learn to predict distributions
. The space of probability mea- sures forms a closed subset of the space of Radon measures M(Y), i.e.,
. From the Riesz represen- tation theorem, M(Y) is the topological dual of the space of continuous measures C(Y), endowed with the uniform convergence norm
. The topological duality between the primal M(Y) and the dual C(Y) defines a pairing, similar to a “scalar product”, between these spaces:
for all and
, where Y is a random variable with law
. This pairing also defines the natural topology to compare measures and to differentiate functionals depending on measures. This is the so-called weak
topology, which corresponds to the convergence in law of random variables. A sequence
is said to converge weak
to some
if for all functions
. Note that when endowing M(Y) with this weak
topology, the dual of M(Y) is C(Y), which is the key to be able to use duality (and in particular Legendre-Fenchel transform) from convex optimization. Using this topology is fundamental to define geometric losses that can cope with arbitrary, possibly highly localized or even singular distributions (for instance sparse sums of Diracs or measures concentrated on thin sets such as 2-D curves or 3-D surfaces).
Similarly to the discrete setting reviewed in 2.1, in the continuous setting, we now wish to predict a distribution
by setting
, where
(i.e.,
is unconstrained), and
is a link function. We propose to use maps between the primal
and the dual score space C(Y) as link functions. As we shall see, such mirror maps are naturally defined by continuous convex function on the primal space, through Fenchel-Legendre duality. Our framework recovers the discrete case Y = [d] as a particular case, with
corresponding to
and
to C([d]), though the isomorphisms
and for all
.
Regularization of optimal transport is our key tool to construct entropy functions which are continuous with respect to the weaktopology, and that can be conjugated to define a
link function. It allows us to naturally leverage a cost
between classes.
3.2. An entropy function for continuous probabilities
The regularized optimal transport cost (2) remains well de-fined when and
belong to a continuous measure space
, with U now being a subset of
with marginal constraints. It induces the self-transport functional (Feydy et al., 2019), that we reuse for our purpose:
We will omit the dependency of on C when clear from context. It is shown by Feydy et al. (2019) that
is continuous and convex on M(Y), and strictly convex on
, where continuity is taken w.r.t. the weak
topol- ogy. We call
, the Sinkhorn negentropy. As a negative entropy function, it can be used to measure the uncertainty in a probability distribution (lower is more uncertain), as illustrated in Figure 2. It will prove crucial in our loss construction. In the above, we have set w.l.o.g.
to recover simple asymptotical behavior of
, as will be clear in Prop. 1.
We first recall some known results from Feydy et al. (2019). Using Fenchel-Rockafellar duality theorem (Rock- afellar, 1966), the function rewrites as the solution to a Kantorovich-type dual problem (see e.g., Villani, 2008). For all
, we have that
where we use the homogeneous dual (i.e. with a log in the maximization), as explained in Cuturi & Peyr´e (2018).
Gradient and extrapolation. is differentiable in the sense of measures (Santambrogio, 2015), meaning that there exists a continuous function
such that, for all
ξ, ξ
, t > 0,
As shown in Feydy et al. (2019), this function , that we call the symmetric Sinkhorn potential, is a particular solution of the dual problem. It is the only function in C(Y) such that
, where the soft C-transform operator (Cuturi & Peyr´e, 2018) is defined as
This operator can be understood as the log-convolution of the measure with the Sinkhorn kernel
. The Sinkhorn potential f has the remarkable property of being defined on all Y, even though the support of
may be smaller. Given any dual solution g to (4), which is defined
-almost everywhere, we have
, i.e. f extrapolates the values of g on the support of
, using the Sinkhorn kernel.
Special cases. The following proposition, which is an original contribution, shows that the Sinkhorn negentropy asymptotically recovers the negative Shannon entropy and Gini index (Gini, 1912) when rescaling the cost. The Sinkhorn negentropy therefore defines a parametric family of negentropies, recovering these important special cases. Note however that on continuous spaces Y, the Shannon entropy is not weakcontinuous and thus cannot be used to define geometric loss and link functions, the softmax link function being geometry-oblivious. Similarly, the Gini index is not defined on
, as it involves the squared values of
in a discrete setting.
Proposition 1 (Asymptotics of Sinkhorn negentropies). For Y compact, the rescaled Sinkhorn negentropy converges to a kernel norm for high regularization . Namely, for all
, we have
Let Y = [d] be discrete and choose . The Sinkhorn negentropy converges to the Shannon negentropy for low-regularization, and into the negative Gini index for high regularization:
Proof is provided in A.1. The first part of the proposition shows that the Sinkhorn negentropies converge to a kernel norm (see e.g., Sriperumbudur et al., 2011). This is similar to the regularized Sinkhorn divergences converging to an Energy Distance (Sz´ekely & Rizzo, 2013) for
(Genevay et al., 2018; Feydy et al., 2019).
Figure 1. The symmetric Sinkhorn potentials form a distance field to a weighted measure. The link function go back from this field in C(Y) to a measure
From probabilities to potentials. The symmetric Sinkhorn potential is a continuous function, or a vector in the discrete setting. It can be interpreted as a distance field to the distribution
. We visualize this field on a 2D space in Figure 1, where Y is the set of
pixels of an image, and we wish to predict a 2-dimensional probability distribution in
. Predicting a distance field
to a measure is more convenient than predicting a distribution directly, as it has unconstrained values and is therefore easier to optimize against. For this reason, we propose to learn parametric models that predict a “distance field”
given an input
. In the following section, we construct a link function
, for general probability measure and function spaces
and C(Y), so to obtain a distributional estimator
.
3.3. Fenchel-Young losses in continuous setting
To that end, we generalize in this section the recentlyproposed Fenchel-Young (FY) loss framework (Blondel et al., 2018; 2019), originally limited to discrete costoblivious measure spaces, to infinite measure spaces. Inspired by that line of work, we use Legendre-Fenchel duality to define loss and link functions from Sinkhorn negative entropies, in a principled manner. We define the LegendreFenchel conjugate of
as
Rigorously, is a pre-conjugate, as
is defined on M(Y), the topological dual of continuous functions C(Y). For a comprehensive and rigorous treatment of the theory of conjugation in infinite spaces, and in particular Banach spaces as is the case of C(Y), see Mitter (2008).
As is strictly convex,
is differentiable everywhere and we have, from a Danskin theorem (Danskin, 1966) with left Banach space and right compact space (Bernhard & Rapaport, 1995, Theorem C.1):
That gradient can be used as a link from
to
. It can also be interpreted as a regularized
prediction function (Blondel et al., 2018; Mensch & Blon- del, 2018). Following the FY loss framework, we define the loss associated with by
In the discrete single-label setting, that loss is also related to the construction of Duchi et al. (2018, Proposition 3). From the Fenchel-Young theorem (Rockafellar, 1970), , with equality if and only if
. The loss
is thus positive, convex and differentiable in its second argument, and minimizing it amounts to find the pre-image
of the target distribution
with respect to the link (mapping)
.
Our construction is a generalization of the Fenchel-Young loss framework (Blondel et al., 2018; 2019), in the sense that it relies on topological duality between C(Y) and , instead of the Hilbertian structure of
and
, to construct the loss
and link function
. We now instantiate the Fenchel-Young loss (6) with Sinkhorn negentropies in order to obtain a novel cost-sensitive loss.
3.4. A new geometrical loss and softmax
The key ingredients to derive a Fenchel-Young loss and a link
are the conjugate
and its gradient. Remarkably, they enjoy a simple form with Sinkhorn negentropies, as shown in the following proposition.
Proposition 2 (Conjugate of the Sinkhorn negentropy). For all , the Legendre-Fenchel conjugate
of
defined in (3) and its gradient read
and where g stands for geometric and LSE for log-sum-exp.
The proof can be found in A.2.
is the usual Fr´echet derivative of
, that lies a priori in the topological dual space of C(Y), i.e. M(Y). From a Danskin theorem (Bernhard & Rapaport, 1995), it is in fact a probability measure. The probability distribution
is typically sparse, as the minimizer of a quadratic on a convex subspace of M(Y). We call the loss
generated by the Sinkhorn negentropy g-logistic loss.
Special cases. Let Y = [d] and cost matrix). From Prop. 1,
asymptotically recovers the negative Shannon entropy when
as
and the neg- ative Gini index when
, as
is then
(Martins & Astudillo, 2016), respectively. Likewise,
recovers the logistic and sparsemax losses. When
, because
if
and 0 otherwise, we see that the logistic loss infinitely penalizes inter-class errors. That is, to obtain zero logistic loss, the model must assign probability 1 to the correct class. The limit case
is the only case for which g-softmax always outputs completely dense distributions. In the continuous case,
degenerates into a posi- tive deconvolution objective with simplex constraint:
Fig. 1 shows that has indeed a deconvolutional effect.
3.5. Computation
Before studying the g-logistic loss and link function
, we now describe practical algorithms for computing
and
in the discrete and continuous cases. The key element in using the g-LSE as a layer in an arbitrary complex model is to minimize the quadratic function
, on
. We can then use the minimum value in the forward pass, and the minimizer in the backward pass, during e.g. SGD training.
Continuous optimisation. In the general case where Y is compact, we cannot represent using a finite vector. Yet, we can use a Frank-Wolfe scheme to progressively add spikes, i.e. Diracs to an iterate sequence
. For this, we need to compute, at each iteration, the gradient of
in the sense of measure (5), i.e. the function in C(Y)
that simply requires to compute the C-transform of on the measure
, similarly to regularized optimal transport. The simplest Frank-Wolfe scheme then updates
Indeed, for , the minimizer of
on
is the Dirac
where
minimizes h. This optimization scheme may be refined to ensure a geometric convergence of
. It can be used to identify Diracs from a continuous distance field f, similar to super-resolution approaches proposed in Bredies & Pikkarainen (2013); Boyd et al. (2017). It requires to work with computer-friendly representation of f, so that we can obtain an approximation of
efficiently, using e.g. non-convex optimization. Another approach is to rely on a deep parametrization of a particle swarm, as proposed by Boyd et al. (2018). We leave such an application for future work, and focus on an efficient discrete solver for the g-LSE and g-softmax.
Figure 2. Left: Geometric softmax and Sinkhorn entropy, for symmetric cost matrices, in the binary case. Predictions from the g-softmax are sparse, as the minimizer of a convex quadratic on the simplex. Right: Level sets of the geometric conjugate. Introducing a cost matrix induces a deformation , the level-set of the log-sum-exp operator, onto the set of symmetric Sinkhorn potentials F. The geometric conjugate defines an extrapolation operator
that replaces the score function onto the cylinder F + R1.
Discrete optimisation. In the discrete case, we can parametrize in logarithmic space, by setting
LSE(l), with
then reads
This objective is non-convex on but invariant with translation and convex on
LSE(l) = 0}. It thus admits a unique solution, that we can find using an unconstrained quasi-Newton solver like L-BFGS (Liu & Nocedal, 1989), that we stop when the iterates are sufficiently stable. For l that maximizes (7), the gradient
softmax(l) is used for backpropagation and at test time. As
is sparse, we expect some coordinates
to go to
. In practice,
then underflows to 0 after a few iterations.
Two-dimensional convolution. In the discrete case, when dealing with two-dimensional potentials and measures, the objective function (7) can be written with a convolution operator, as where
. It is therefore efficiently computable and differentiable on GPUs, especially when the kernel C is separable in height and width, e.g. for the
norm, in which case we perform 2 successive one-dimensional convolutions. We use this computational trick in our variational auto-encoder experiments (
5).
We start by studying the mirror map , that we expect to invert the mapping
. This study is necessary as we cannot rely on typical conjugate inversion results (e.g., Rockafellar, 1970, Theorem 26.5), that would stipulate that
on the domain of
. Indeed, this result is stated in finite dimension, and requires that
and
be Legendre, i.e. be strictly convex and differentiable on their domain of definition, and have diverging derivative on the boundaries of these domains (see also Wainwright & Jordan, 2008). This is not the case of the Sinkhorn negentropy, which requires novel adjustements. With these at hands, we show that parametric models involving a final g-softmax layer can be trained to minimize a certain wellbehaved Bregman divergence on the space of probability measures. Proofs are reported in
A.3 and
A.4
4.1. Geometry of the link function
We have constructed the link function in hope that it would allow to go from a symmetric Sinkhorn potential
back to the original measure
. The following lemma states that this is indeed the case, and derives two consequences on the space of symmetric Sinkhorn potentials, defined as
.
Lemma 1 (Inversion of the Sinkhorn potentials).
The computation of the Sinkhorn potential thus inverts the g-LSE operator on the space F, which is included in the 0-level set of . This is similar to the set
being the 0 level set of the log-sum-exp function when using the Shannon negentropy as
.
This corollary is not sufficient for our purpose, as we want to characterize the action of on all continuous functions
. For this, note that the g-LSE operator
has the same behavior as the log-sum-exp when composed with the addition of a constant
:
Therefore, for all , which almost makes
a part of the space of potentials F. Yet, in contrast with the Shannon entropy case, the inclusion of
in F is strict. Indeed, following
3.2
implies that there exists
such that
is the image of the C-transform operator. The operator
has therefore an extrapolation effect, as it replaces
onto the set of Sinhorn potentials. This is made clear by the following proposition.
Proposition 3 (Extrapolation effect of ). For all
, we define the extrapolation of f to be
Then, for all
The extrapolation operator translates f to , extrapolates
so that it becomes a Sinkhorn potential, then translates back the result so that
. Its effects clearly appears on Figure 2 (right), where we see that
is a projection of f onto the cylinder F +R.
4.2. Relation to Hausdorff divergence
Recall that the Bregman divergence (Bregman, 1967) generated by a strictly convex is defined as
When is the classical negative Shannon entropy
, it is well-known that
equals the KullbackLeibler divergence and it is easy to check that
The equivalence between Fenchel-Young loss and composite Bregman divergence
, however, no longer holds true when
is the Sinkhorn negentropy de-fined in (3). In that case,
can be interpreted as an asymmetric Hausdorff divergence (Aspert et al., 2002; Feydy et al., 2019). It forms a geometric divergence akin to OT distances, and estimates the distance between distribution supports. As we now show,
provides an upper-bound on the composition of that divergence with
.
Proposition 4 (upper-bounds Hausdorff divergence).
with equality if supp supp
.
In contrast with the KL divergence, the asymmetric Hausdorff divergence is finite even when , a geometrical property that it shares with optimal transport divergences. We now use Prop. 4 to derive a new consistency result justifying our loss. Let us assume that input features and output distributions follow a distribution
. We define the Hausdorff diver- gence risk and the Fenchel-Young loss risk as
where the expectation is taken w.r.t. . We define their associated Bayes estimators as
The next proposition guarantees calibration of with respect to the asymmetric Hausdorff divergence
.
Proposition 5 (Calibration of the g-logistic loss). The g-logistic loss where
is defined in (3) is Fisher consistent with the Hausdorff divergence
for the same
. That is,
The excess of risk in the Hausdorff divergence is controlled by the excess of risk in the g-logistic loss. For all C(Y), we have
This result, that follows the terminology of Tewari & Bartlett (2005), shows that is suitable for learning predictors that minimize
.
We present two experiments that demonstrate the validity and usability of the geometric softmax in practical usecases. We provide a PyTorch package for reusing the discrete geometric softmax layer1.
5.1. Ordinal regression
We first demonstrate the g-softmax for ordinal regression. In this setting, we wish to predict an ordered category among d categories, and we assume that the cost of predicting instead of y is symmetric and depends on the difference between
and y. For instance, when predicting ratings, we may have three categories bad
average
good. This is typically modeled by a cost-function
, where
is the
or
cost. We use the real-world ordinal datasets provided by Gutierrez et al. (2016), using their predefined 30 cross-validation folds.
Experiment and results. We study the performance of the geometric softmax in this discrete setting, where the score function is assumed to be a linear function of the input features , i.e,
, with
,
and
. We compare its performance to multinomial regression, and to immediate threshold and all-threshold logistic regression (Rennie & Srebro, 2005), using a reference implementation provided by Pedregosa et al. (2017). We use a cross-validated
penalty term on the linear score model
. To compute the Hausdorff divergence at test time and the geometric loss during training, we set
.
The results, aggregated over datasets and cross-validation folds, are reported in Table 1. We observe that the g-logistic regression performs better than the others for the Hausdorff divergence on average. It performs slightly worse than a simple logistic regression in term of accuracy, but
Table 1. Performance of geometric loss as a drop-in replacement in linear models for ordinal regression. Our method performs better w.r.t. its natural metric, the Hausdorff divergence.
slightly better in term of mean absolute error (MAE, the reference metric in ordinal regression). It thus provides a viable alternative to thresholding techniques, that performs worse in accuracy but better in MAE. It has the further advantage of naturally providing a distribution of output given an input x. We simply have, for all , p(Y = y| X = x) = (g-softmax
.
Calibration of the geometric loss. We validate Prop. 5 experimentally on the ordinal regression dataset car. During training, we measure the geometric cross-entropy loss and the Hausdorff divergence on the train and validation set. Figure 3 shows that is indeed an upper bound of
, and that the difference between both terms reduces to almost 0 on the train set. Prop. 5 ensures this finding provided that the set of scoring function is large enough, which appears to be approximately the case here.
Figure 3. Training curves for ordinal regression on dataset car. The difference between the g-logistic loss and the Hausdorff divergence vanishes on the train set.
5.2. Drawing generation with variational auto-encoders
The proposed geometric loss and softmax are suitable to estimate distributions from inputs. As a proof-of-concept experiment, we therefore focus on a setting in which distributional output is natural: generation of hand-drawn doodles and digits, using the Google QuickDraw (Ha & Eck, 2018) and MNIST dataset. We train variational autoencoders on these datasets using, as output layers, (1) the KL divergence with normalized output and (2) our geometric loss with normalized output. These approaches output an image prediction using a softmax/g-softmax over all pixels, which is justified when we seek to output a concentrated distributional output. This is the case for doodles and digits, which can be seen as 1D distributions in a 2D space. It differs from the more common approach that uses a binary cross-entropy loss for every pixel and enables to capture interactions between pixels at the feature extraction level. We use standard KL penalty on the latent space distribution.
Using the g-softmax takes into account a cost between pix-
Figure 4. The g-softmax layer permits to generate and reconstruct drawing in a more concentrated manner. For a same level of variational penalty, the g-softmax better and faster minimizes the asymmetric Hausdorff divergence. See also Figure 6.
els (i, j) and (k, l), that we set to be the Euclidean cost , where C is the
cost and
is the typical distance of interaction—we choose
in our experiments. We therefore made the hypothesis that it would help in reconstructing the input distributions, forming a non-linear layer that captures interaction between inputs in a nonparametric way.
Results. We fit a simple MLP VAE on 28x28 images from the QuickDraw Cat dataset. Experimental details are reported in Appendix B (see Figure 6). We also present an experiment with 64x64 images and a DCGAN architecture, as well as visualization of a VAE fitted on MNIST. In Fig- ure 4, we compare the reconstruction and the samples after training our model with the g-softmax and simple softmax loss. Using the g-softmax, which has a deconvolutional effect, yields images that are concentrated near the edges we want to reconstruct. We compare the training curves for both the softmax and g-softmax version: using the g-softmax link function and its associated loss better minimizes the asymmetric Hausdorff divergence. The cost of computation is again increased by a factor 10.
We introduced a principled way of learning distributional predictors in potentially continuous output spaces, taking into account a cost function in between inputs. We constructed a geometric softmax layer, that we derived from Fenchel conjugation theory in Banach spaces. The key to our construction is an entropy function derived from regularized optimal transport, convex and weakcontinuous on probability measures. Beyond the experiments in discrete measure spaces that we presented, our framework opens the doors for new applications that are intrinsically off-the-grid, such as super-resolution.
The work of A. Mensch and G. Peyr´e has been supported by the European Research Council (ERC project NORIA). A. Mensch thanks Jean Feydy and Thibault S´ejourn´e for fruitful discussions.
Arjovsky, M., Chintala, S., and Bottou, L. Wasserstein gen- erative adversarial networks. In Proceedings of the International Conference on Machine Learning, pp. 214–223, 2017.
Aspert, N., Santa-Cruz, D., and Ebrahimi, T. Mesh: Mea- suring errors between surfaces using the hausdorff distance. In Proceedings of the IEEE International Conference on Multimedia and Expo, pp. 705–708, 2002.
Bernhard, P. and Rapaport, A. On a theorem of Danskin with an application to a theorem of Von Neumann-Sion. Nonlinear Analysis: Theory, Methods & Applications, 24(8):1163–1181, 1995.
Blondel, M., Martins, A. F. T., and Niculae, V. Learning classifiers with Fenchel-Young losses: Generalized entropies, margins, and algorithms. In Proceedings of the International Conference on Artificial Intelligence and Statistics, 2018.
Blondel, M., Martins, A. F., and Niculae, V. Learning with Fenchel-Young losses. arXiv:1901.02324, 2019.
Boyd, N., Schiebinger, G., and Recht, B. The alternating descent conditional gradient method for sparse inverse problems. SIAM Journal on Optimization, 27(2):616– 639, 2017.
Boyd, N., Jonas, E., Babcock, H. P., and Recht, B. DeepLoco: Fast 3D localization microscopy using neural networks. BioRxiv, pp. 267096, 2018.
Bredies, K. and Pikkarainen, H. K. Inverse problems in spaces of measures. ESAIM: Control, Optimisation and Calculus of Variations, 19(1):190–218, 2013.
Bregman, L. M. The relaxation method of finding the com- mon point of convex sets and its application to the solution of problems in convex programming. USSR Computational Mathematics and Mathematical Physics, 7(3): 200–217, 1967.
Ciliberto, C., Rosasco, L., and Rudi, A. A consistent reg- ularization approach for structured prediction. In Advances in Neural Information Processing Systems, pp. 4412–4420, 2016.
Courty, N., Flamary, R., Habrard, A., and Rakotomamonjy, A. Joint distribution optimal transportation for domain adaptation. In Advances in Neural Information Processing Systems, pp. 3730–3739, 2017.
Crammer, K. and Singer, Y. On the algorithmic implemen- tation of multiclass kernel-based vector machines. Journal of Machine Learning Research, 2:265–292, 2001.
Cuturi, M. Sinkhorn distances: Lightspeed computation of optimal transport. In Advances in Neural Information Processing Systems, pp. 2292–2300, 2013.
Cuturi, M. and Doucet, A. Fast computation of Wasser- stein barycenters. In International Conference on Machine Learning, pp. 685–693, 2014.
Cuturi, M. and Peyr´e, G. Semi-dual regularized optimal transport. SIAM Review, 60(4):941–965, 2018.
Danskin, J. M. The theory of max-min, with applications. SIAM Journal on Applied Mathematics, 14(4):641–664, 1966.
Duchi, J. C., Khosravi, K., and Ruan, F. Multiclass clas- sification, information, divergence, and surrogate risk. Annals of Statistics, 2018.
Feydy, J. and Trouv´e, A. Global divergences between mea- sures: From Hausdorff distance to optimal transport. In ShapeMI: Shape in Medical Imaging, 2019.
Feydy, J., S´ejourn´e, T., Vialard, F.-X., Amari, S.-i., Trouv´e, A., and Peyr´e, G. Interpolating between optimal transport and MMD using Sinkhorn divergences. In Proceedings of the International Conference on Artifical Intelligence and Statistics, 2019.
Frogner, C., Zhang, C., Mobahi, H., Araya, M., and Pog- gio, T. A. Learning with a Wasserstein loss. In Advances in Neural Information Processing Systems, pp. 2053–2061, 2015.
Genevay, A., Cuturi, M., Peyr´e, G., and Bach, F. Stochas- tic optimization for large-scale optimal transport. In Advances in Neural Information Processing Systems, pp. 3440–3448, 2016.
Genevay, A., Peyr´e, G., and Cuturi, M. Learning generative models with Sinkhorn divergences. In Proceedings of the International Conference on Artificial Intelligence and Statistics, 2018.
Gimpel, K. and Smith, N. A. Softmax-margin CRFs: Train- ing log-linear models with cost functions. In Proceedings of the North American Chapter of the Association for Computational Linguistics, 2010.
Gini, C. Variabilit`a e Mutuabilit`a. C. Cuppini, Bologna, 1912.
Gutierrez, P. A., Perez-Ortiz, M., Sanchez-Monedero, J., Fernandez-Navarro, F., and Hervas-Martinez, C. Ordinal regression methods: Survey and experimental study. IEEE Transactions on Knowledge and Data Engineering, 28(1):127–146, 2016.
Ha, D. and Eck, D. A neural representation of sketch draw- ings. In International Conference on Learning Representations, 2018.
Kusner, M., Sun, Y., Kolkin, N., and Weinberger, K. From word embeddings to document distances. In Proceedings of the International Conference on Machine Learning, pp. 957–966, 2015.
Liu, D. C. and Nocedal, J. On the limited memory BFGS method for large scale optimization. Mathematical Programming, 45(1-3):503–528, 1989.
Luenberger, D. G. Optimization by vector space methods. John Wiley & Sons, 1997.
Luise, G., Rudi, A., Pontil, M., and Ciliberto, C. Differ- ential properties of Sinkhorn approximation for learning with Wasserstein distance. In Advances in Neural Information Processing Systems 31, pp. 5864–5874, 2018.
Martins, A. F. T. and Astudillo, R. F. From Softmax to Sparsemax: A sparse model of attention and multi-label classification. Proceedings of the International Conference on Machine Learning, pp. 1614–1623, 2016.
Mensch, A. and Blondel, M. Differentiable dynamic pro- gramming for structured prediction and attention. In Proceedings of the International Conference on Machine Learning, pp. 3462–3471, 2018.
Mitter, S. K. Convex optimization in infinite dimensional spaces. In Recent Advances in Learning and Control, volume 371, pp. 161–179. Springer, 2008.
Montavon, G., M¨uller, K.-R., and Cuturi, M. Wasserstein training of restricted Boltzmann machines. In Lee, D. D., Sugiyama, M., Luxburg, U. V., Guyon, I., and Garnett, R. (eds.), Advances in Neural Information Processing Systems 29, pp. 3718–3726. Curran Associates, Inc., 2016.
Pedregosa, F., Bach, F., and Gramfort, A. On the consis- tency of ordinal regression methods. Journal of Machine Learning Research, 18(1):1769–1803, 2017.
Radford, A., Metz, L., and Chintala, S. Unsupervised rep- resentation learning with deep convolutional generative adversarial networks. In International Conference on Learning Representations, 2016.
Reid, M. D. and Williamson, R. C. Composite binary losses. Journal of Machine Learning Research, 11: 2387–2422, 2010.
Rennie, J. D. and Srebro, N. Loss functions for preference levels: Regression with discrete ordered labels. In Proceedings of the IJCAI Multidisciplinary Workshop on Advances in Preference Handling, pp. 180–186, 2005.
Rockafellar, R. T. Extension of Fenchel duality theorem for convex functions. Duke Mathematical Journal, 33 (1):81–89, 1966.
Rockafellar, R. T. Convex Analysis. Princeton University Press, 1970.
Rolet, A., Cuturi, M., and Peyr´e, G. Fast dictionary learn- ing with a smoothed Wasserstein loss. In Artificial Intelligence and Statistics, pp. 630–638, 2016.
Santambrogio, F. Optimal transport for applied mathematicians. Birk¨auser, NY, 2015.
Sriperumbudur, B. K., Fukumizu, K., and Lanckriet, G. R. G. Universality, Characteristic Kernels and RKHS Embedding of Measures. Journal of Machine Learning Research, 12:2389–2410, 2011.
Sz´ekely, G. J. and Rizzo, M. L. Energy statistics: A class of statistics based on distances. Journal of Statistical Planning and Inference, 143(8):1249–1272, 2013.
Tewari, A. and Bartlett, P. L. On the consistency of mul- ticlass classification methods. Learning Theory, 3559: 143–157, 2005.
Tsochantaridis, I., Joachims, T., Hofmann, T., and Altun, Y. Large margin methods for structured and interdependent output variables. Journal of Machine Learning Research, 6:1453–1484, 2005.
Villani, C. Optimal transport: Old and new. Springer, 2008.
Wainwright, M. J. and Jordan, M. I. Graphical models, exponential families, and variational inference. Foundations and Trends in Machine Learning, 1(1–2):1–305, 2008.
Weston, J. and Watkins, C. Support vector machines for multi-class pattern recognition. In Proceedings of the European Symposium on Artificial Neural Networks, pp. 219–224, 1999.
Williamson, R. C., Vernet, E., and Reid, M. D. Compos- ite multiclass losses. Journal of Machine Learning Research, 17(223):1–52, 2016.
We prove propositions by order of appearance in the main text.
Proof. We start by showing the Shannon entropy limit of the Sinkhorn entropy, in the discrete case. In this case, we use the standard Kantorovich dual (Cuturi, 2013). Let , and
For f optimal in (9), letting , we have, using element-wise multiplication
,
Let us now consider the limit for of
, for an arbitrary symmetric cost matrix C. We rewrite
is then a simple consequence of the asymptotics of Sinkhorn OT distances (Genevay et al., 2018), that we apply in the symmetric case. In the discrete setting, the result for becomes, if
,
Proof. We can rewrite the self transport with the change of variable , due to Feydy & Trouv´e (2019). We then have
, and
Ω(12OT
max
log
exp(
)2
max
log d
log
exp(
) 2 )d
)d
)
is the kernel norm defined with kernel . Then, the conjugate of
reads, for all
,
= max log d
log
exp
)d
)d
)
exp(
)d
)d
where we have used the conjugation of the relative entropy over the space of probability measure :
max log d
exp(f(x)2 )d
We now revert the first change of variable, setting , and
. We have
Ωmax
log
exp(
) + f(y) + C(x, y)2 )d
)d
g-LSE(min
exp(
2 )
We have assumed that is positive definite, which ensures that the bivariate function
is strictly convex in and in f. Let
. The gradient of
with respect to f is a measure that reads
exp(
where we recall
From a generalized version of the Danskin theorem (Bernhard & Rapaport, 1995), the function
is differentiable everywhere and has for gradient . Composing with the log, we obtain
(Y), and
exp(
where indicates proportionality. To conclude, we use Lemma 2, that describes the minimizers of (10), and that we prove in the next section. It ensures that
on the support of
. Therefore
We first state and proof Lemma 2 on optimality condition in the minimization of . We then prove Lemma 1, establish some basic properties of the extrapolation operator and prove Prop. 3.
A.3.1. NECESSARY AND SUFFICIENT CONDITION OF OPTIMALITY IN
Finding the minimizer of
amounts to finding the distribution for which
and its Ctransform
are the less distant, as it appears in the following lemma.
Lemma 2 (from first order optimality condition).
is the only distribution
such that there exists a constant
such that
We then have . (11) form sufficient optimality conditions for finding
.
Proof. We use an infinite version of the KKT condition (Luenberger, 1997, Section 9) to solve the optimality of , as defined in (10). We fix
. The Lagrangian associated to the minimization of
over the space of probability measure M(X) reads
A necessary and sufficient condition for to be optimal is the existence of a function
and a real
such that,
(primal feasibility),
(stationarity),
(dual feasibility),
(complementary slackness),
where the derivative is the displacement derivative (5), computed as
2
on the support of
, and
Replacing in the definition , and using the equality
we obtain log(
and the first part of the lemma follows. Then, note that for all
,
. Removing
from both side of inequality (12), we obtain
with equality on the support of , which brings the second part of the lemma.
Proof. Let and
. From the optimality condition of Sinkhorn dual minimization (4),
hence, meets the sufficient conditions for optimality in Lemma 2. Therefore
, and the first part of the lemma follows. To demonstrate the second part, we consider
. There exists
such that
, and thus
A.3.3. EXTRAPOLATION EFFECT OF —PROOF OF PROP. 3
We start by establishing some basic properties of the extrapolation operator.
Lemma 3 (Properties of ). The following properties hold, for all
,
ii. The extrapolation operator maintain the following values:
i. Note that for all
. Removing
from both side of inequality (12), we obtain
ii. We set . According to Lemma 2, for all
and
Furthermore, for all , and therefore, as the soft C-transform operator is nonincreasing with respect to f,
where the left equality stems from the definition of . Therefore
on all Y, and we meet the sufficient condition of Lemma 2 for the optimality of in
We thus have . Therefore
where we have used on the third line the fact that the value of depends only on the values of f on the support of
. In our case, we have
, from Lemma 2. The lemma follows.
With Lemma 1 and Lemma 3 at hand, we are now ready to prove Prop. 3.
Proof. We consider a function . By construction of the extrapolation
,
is a negative symmetric Sinkhorn potentials, as . Therefore, from Lemma 1,
where the third equality stems from Lemma 3, property (ii), and the second from (8).
We now turn to proving Prop. 4 and Prop. 5, that justifies the validity of the geometric logistic loss for a certain Bregman divergence, dubbed the asymmetric Hausdorff divergence.
Proof. Let and
. By definition, the Hausdorff divergence
between
and
rewrites
This decomposition is a generic way of decomposing a Bregman divergence into a Fenchel-Young loss plus a perturbation term that depends on the “projection” . In our case, thanks to Lemma 3, property (iv), this term rewrites
The second term is null as a consequence of Lemma 3, while the third is null because and
are both probability measures. The first one is null in case
, in accordance to Lemma 3, property (i). The proposition follows from the fact that
on the space Y, according to the same property.
Proof. As a consequence of Prop. 4, for any true and estimated distribution , we have
where the last term is null as and
from Lemma 1. Therefore
The equality of risks and the connection between minimizers immediately follows. To establish the Fisher consistency of the g-FY loss with respect to the Hausdorff divergence, note that, from Prop. 4, we have, for all , for all
,
Taking the expectation with respect to the data distribution D, we obtain
High definition experiment. As a complementary experiment, we generate a dataset of cat doodles from the Google QuickDraw dataset, with a line width of one pixel. We test the g-softmax link function and the geometric Fenchel-Young loss functions to train a VAE with a DC-GAN architecure (Radford et al., 2016). We reuse the architecture of the authors, using the discriminator as an encoder, with a final layer with a size of output twice the size of the latent dimension, to model the mean and variance of the latent encoding, and the generator as a decoder. Similarly to the experiment in the main text, we observe that the generated samples and the reconstructions are more concentrated on thin measures.
MNIST. We display a visualization of generates images and reconstruction of test image in Figure 5. The output distributions are well concentrated, despite the low resolution of the dataset.
Architecture Our multi-layer perceptron is simple: encoder and decoder are two layer MLP with 400 hidden units and ReLU activation.
Hyperparameters. We use a latent size of 100 in the experiment on QuickDraw 28x28, and 256 for the high resolution experiment. We set the KL weight to 1, and rescale the KL loss with a factor , to make its gradient of the same order as the one computed with separated binary cross entropy. We use
as the scaling parameter of the Euclidean cost function.
Figure 5. Examples of generated images and reconstruction of test images with an MLP VAE on MNIST dataset.
Figure 6. Examples of generated images and reconstruction of test images with a VAE-DC-GAN and a geometric softmax last layer. The generated images are sharper than when using a standard softmax layer and a KL divergence training.