# visualizing Similarity Data with a Mixture of Maps

## Introduction

The main idea of this paper is to show how we can utilize several different two-dimensional maps in order to visualize a set of pairwise similarities. Aspect maps resemble both clustering (in modeling pair-wise similarities as a mixture of different types of similarity) and multi-dimensional scaling (in modeling each type of similarity by a two-dimensional map) . While methods such as PCA and MDS (Metric Multi-dimensional Scaling) are simple and fast, their main drawback can be seen in minimizing a cost function that is mainly focused on modeling large dissimilarities rather than small ones. As a result of that, they do not provide good visualizations of data that lies on a curved low-dimensional manifold in a high dimensional space. Also methods such as Local MDS, LLE, Maximum Variance Unfolding or Stochastic Neighbour Embedding (SNE) model local distances accurately in the two-dimensional visualization, but modeling of larger distances is done inaccurately.

SNE outweighs methods such as LLE in two ways: Despite difficulty of optimizing the SNE objective function, it leads to much better solutions and since SNE is based on probabilistic model, it is much more efficient in producing better visualization. In the next section, we will explain how SNE works.

## Stochastic Neighbour Embedding

The core of SNE method <ref> G. Hinton and S. Roweis. Stochastic neighbor embedding. Advances in Neural Information Processing Systems, 15:833–840, 2003 </ref> lies in converting high-dimensional distance or similarity data into a set of $\mathbf{ p_{j|i} }$, each of which represent the probability that one object $i$ pick another object $j$ as its neighbour if it was only allowed to pick one neighbour. For objects in high dimensional Euclidian space, where our data points consists of the coordinates of the objects, we can find $\mathbf{ p_{j|i} }$ for each object $i$ by using a spherical Gaussian distribution centered at the high-dimensional position of $i$, $\mathbf{ X_{i}}$. We will set $\mathbf{ p_{i|i} = 0 }$ and for $\mathbf{ j \neq i }$,

$\mathbf p_{j|i} = \frac{\exp(-||x_i-x_j ||^2/ 2\sigma_i ^2 )}{\sum_{k \neq i} \exp(-||x_i-x_k ||^2/ 2\sigma_i ^2 ) }$

Intuitively, if one object, say $\, i$, is only allowed to pick one neighbor, say $\, j$, $\, j$ should be the best one with the minimum relative distance. In other words, the more the relative distance from $\, i$, the less the probability of being chosen as one-allowed neighbor. With this intuition, it makes sense to define $\mathbf p_{j|i}$ so that the numerator is proportional to $\, j$'s distance from $\, i$ and the denominator is proportional to sum of all probable neighbors' distance from $\, i$.

Note that given a set of pairwise distances between objects, $\mathbf{|| x_i - x_j ||}$, we can use the above equation to derive the same probabilities. In practice, given a set of $N$ points, we set the variance of the Gaussian $\mathbf{ \sigma_i ^2}$, either by hand or we find it by a binary search for the values of $\mathbf{ \sigma_i }$ that make the entropy of the distribution over neighbours equal to $\mathbf{ \log_2 M}$ (Remember that the entropy of the distribution $\mathbf{ P_i}$ is defined as $\int_{-\infty}^{+\infty}p(x)\log(1/p(x))dx$ and $\mathbf{ p(x)\log(1/p(x))}$ is understood to be zero when $\mathbf{p(x)=0)}$.) This is done by starting from a number $\mathbf{ M \ll N}$ and performing the binary search until the entropy of $\mathbf{ P_i}$ is within some predetermined small tolerance of $\mathbf{\log_2 M }$.

Our main goal in SNE is to model $\mathbf{p_{j|i}}$ by using the conditional probabilities $\mathbf{q_{j|i}}$, which are determined by the locations $\mathbf{ y_i}$ of points in low-dimensional space:

$q_{j|i} = \frac{\exp(-||y_i-y_j ||^2)}{\sum_{k \neq i} \exp(-||y_i-y_k ||^2) }$

The aim of embedding is to match these two distributions as well as possible. To do so, we minimize a cost function which is a sum of Kullback-Leibler divergences between the original $\mathbf{p_{j|i}}$ and induced $\mathbf{ q_{j|i}}$ distributions over neighbours for each object:

$C = \sum_{i} KL(P_i||Q_i) =\sum_{i}\sum_{j \neq i} p_{j|i} \log \frac{p_{j|i}}{q_{j|i}}$

The dimensionality of the $\mathbf{Y}$ space is chosen to be much less than the number of objects.

### The SNE cost function focuses more on local structure than global structure

In the introduction, we mentioned that SNE focuses more on modeling small similarities (local structure) rather than large similarities (global structure). The precise meaning of this statement can now be understood by looking at the cost function, or more specifically, the asymmetry of Kullback-Leibler divergence in the sense that $KL(X_1||X_2) \neq KL(X_2||X_1) \,$.

Recall that in the context of coding theory, $KL(P||Q) \,$ is the extra bits required to code samples from $P \,$(the true probability) using a code based on $Q\,$(the model probability). Also recall that in the optimal code, a sample with a higher probability is coded using fewer bits. When using a code based on $Q\,$ to model samples from $P\,$, inefficiency is unavoidable. Note that it is much more wasteful to (1)use longer-than-optimal codes for samples which has high probability (in P) than (2)use shorter-than-optimal codes for samples which has low probability (in P). Case (1) corresponds to using a small $q_i \,$ to model a big $p_i \,$; and Case (2) corresponds to using a big $q_i \,$ to model a small $p_i \,$. This asymmetry is also clear from the mathematical definition of KL divergence.

Similarly, in the SNE cost function, it is much more costly to (1)use a small $\mathbf{ q_{j|i}}$ to model a big $\mathbf{ p_{j|i}}$ than (2)use a big $\mathbf{ q_{j|i}}$ to model a small $\mathbf{ p_{j|i}}$. Case (1) corresponds to modeling small distances incorrectly; and Case (2) corresponds to modeling big distances incorrectly.

Therefore SNE is an improvement over methods like LLE; While SNE emphasizes local distances, its cost function cleanly enforces both keeping the images of nearby objects nearby and keeping the images of widely separated objects relatively far apart.

### Computational aspect of SNE

Despite the fact that differentiating $\mathbf{C}$ is tedious because $\mathbf{y_k}$ affects $\mathbf{ q_{j|i}}$ via the normalization term in its definition, the final result is simple and has nice physical interpretation:

$\frac{\partial C}{\partial y_i} = 2\sum_{j} (y_i-y_j)([p_{j|i}-q_{j|i}]+[p_{i|j}-q_{i|j}])$

Using the steepest descent for minimizing $\mathbf{C}$ in which all of the points are adjusted in parallel is inefficient and has the drawback of getting stuck in poor local minima. In order to address this problem, we add gaussian noise to the $\mathbf{y}$ values after each update. We start by a high level of noise and reduce the noise level rapidly to find the approximate noise level at which the structure starts starts to form in the low-dimensional map. Once we observed that a small increase in the noise level leads to a large decrease in the cost function, we can be sure that a structure is emerging; Now by repeating this process and starting from the noise level just above the level at which structure emerged and refining it gently, we can find low-dimensional maps that are significantly better minima of $\mathbf{C}$.

## Symmetric SNE

An alternative approach to SNE which is based on minimizing the divergence between conditional distributions, is to define a single joint distribution over all non-identical ordered pairs:

In this case we define $\mathbf{p_{ij}}$ by

$\mathbf p_{ij} = \frac{\exp(-||x_i-x_j ||^2/ 2\sigma^2 )}{\sum_{k \lt l} \exp(-||x_k-x_l ||^2/ 2\sigma^2 ) }$

$\mathbf{q_{ij}}$'s are defined by

$\mathbf q_{ij} = \frac{\exp(-||y_i-y_j ||^2 )}{\sum_{k \lt l} \exp(-||y_k-y_l ||^2) }$

and finally the symmetric version of our cost function, $\mathbf{C_{sym}}$, becomes the KL divergence between the two distributions

$C_{sym} = KL(P||Q) =\sum_{i \neq j} p_{ij} \log \frac{p_{ij}}{q_{ij}}$

The benefit of defining $\mathbf{p_{ij}}$'s like this is getting much simpler derivatives. If one of the high-dimensional points, $\mathbf{j}$, is far from all of the others, all of the $\mathbf{p_{.j}}$ will be very small. In this case, we replace $\mathbf{p_{ij}}$ by $\mathbf{p_{ij}=0.5(p_{j|i}+p_{i|j})}$. When $\mathbf{j}$ is far from all the other points, all of the $\mathbf{p_{j|i}}$ will be very small, but $\mathbf{p_{.|j}}$ will sum to 1.

#### Remark on "symmetry"

"Symmetric" SNE refers to the fact that $\mathbf{p_{ij}} = \mathbf{p_{ji}}$ as opposed to $\mathbf{p_{i|j}} \neq \mathbf{p_{j|i}}$ in basic SNE. Symmetric SNE still uses the asymmetric KL divergence in its cost function.

## Aspect Maps

Another approach for defining $\mathbf{q_{j|i}}$ is allowing $\mathbf{i}$ and $\mathbf{j}$ to occur in several different two-dimensional maps and assigning a mixing proportion $\mathbf{\pi_{i}^{m}}$ in m-th map to the object $\mathbf{i}$. Note that we should have $\mathbf{\sum_{m} \pi_{i}^{m}=1}$. Now by using these different maps, we define $\mathbf{q_{j|i}}$ as follows:

$q_{j|i} = \frac{\sum_{m} \pi_{i}^{m}\pi_{j}^{m} e^{-d_{i,j}^{m}} }{z_i}$

where

$d_{i,j}^{m}=|| y_i^m-y_j^m ||^2, \quad z_i=\sum_{h}\sum_{m} \pi_{i}^{m} \pi_{h}^{m} e^{-d_{i,h}^{m}}$

Using a mixture model is very different from simply using a single space that has extra dimensions, because points that are far apart on one dimension cannot have a high $\mathbf{q_{j|i}}$ no matter how close together they are on the other dimensions; On the contrary, when we use a mixture model, provided that there is at least one map in which $\mathbf{i}$ is close to $\mathbf{j}$ and provided that the versions of $\mathbf{i}$ and $\mathbf{j}$ in that map have high mixing proportions, it is possible for for $\mathbf{q_{j|i}}$ to be quite large even if $\mathbf{i}$ and $\mathbf{j}$ are far apart in all the other maps.

To optimize the aspect map models, we used Carl-Rasmussen's "minimize function" given in <ref> www.kyb.tuebingen.mpg.de/bs/people/carl/code/minimize/ </ref>. The gradiants are given by:

$\frac{\partial C}{\partial \pi_i^m}=-\sum_{k}\sum_{l \neq k} p_{l|k} \frac{\partial}{\partial \pi_i^m} [\log q_{l|k}z_k -\log z_k]$

Now by substituting the definition of $\mathbf{z_k}$ and reshuffling the terms we will have:

$\frac{\partial C}{\partial \pi_i^m}=\sum_{j}[\frac{1}{q_{j|i} z_i}(q_{j|i}-p_{j|i})+\frac{1}{q_{i|j} z_j}(q_{i|j}-p_{i|j}) ] \pi_{j}^{m}e^{-d^m_{i,j}}$

In practice, we will not be using mixing proportions $\mathbf{\pi_i^m}$ themselves as parameters of the model; Instead, we define $\mathbf{w_i^m}$ by:

$\pi_i^m = \frac{e^{-w_i^m}}{\sum_{m'}e^{-w_i^{m'}}}$

as a result of that, the gradient becomes:

$\frac{\partial C}{\partial w_i^m} = \pi_i^m \left[ \left(\sum_{m'}\frac{\partial C}{\partial \pi_i^{m'}} \pi_i^{m'}\right)-\frac{\partial C}{\partial \pi_i^m}\right]$

## Modeling Human Word Association Data

In order to see how SNE works in practice, authors used The University of South Florida database on human word associations which is available on the web. Participants in the study were presented with a list of English words as cues, and asked to respond to each word with a word which was “meaningfully related or strongly associated” <ref> D. L. Nelson, C. L. McEvoy, and T. A. Schreiber. The university of south florida word association, rhyme, and word fragment norms. In http://www.usf.edu/FreeAssociation/, 1998. </ref> The database contains 5018 cue words, with an average of 122 responses to each. The probability $p_{j|i}$ is defined in a natural manner as the fraction of times the word $j$ was picked in response to word $i$.
SNE has some problems with ambiguous words such as 'fire', 'wood', and 'job'. Puting 'fire' close to 'wood' , and 'job' where the two latter words are not related is a misconception in SNE. AMSNE has a solution for this kind of problem by considering the word 'fire' as a mixture of two different meanings. 'fire', in one map, is close to 'wood' and in the other is close to 'job'. Besides ambiguity, a word belong to different places for a different reason. This may be seen in the word 'death' which is close to 'sad' & 'cancer' and 'military' & 'destruction' as well.

## Applications

In NIPS 2008 Conference, there was a demonstration by L. van der Maaten and G.Hinton on Visualizing NIPS Cooperations using Multiple Maps t-SNE <ref>http://nips.cc/Conferences/2008/Program/event.php?ID=1472 </ref>. Their demonstration showed visualizations of NIPS co-authorships that were constructed by the multiple maps version of t-SNE. They showed that it is impossible for multidimensional scaling techniques to construct an appropriate visualization of the similarity data, because of the triangle inequality problem and therefore they created multiple maps version of t-SNE based on the idea proposed in this paper. In these maps, each author has a copy , and each copy is weighted by a mixing proportion (the mixing proportions for a single author over all maps sum up to 1). The multiple maps version of t-SNE can deal with the triangle inequality problem, and as a result, it is very good at visualizing NIPS co-authorship data.

<references/>