I have a dataset, where the features are comprised of points arranged in a regular grid on a simplex. Each of these points are defined as follows: A point $\mathbf{x}$ on the simplex can be represented as a vector in $\mathbb{R}^n$ such that:
\begin{equation} \mathbf{x} = \left( x_1, x_2, \ldots, x_n \right) \end{equation}
subject to the following conditions:
\begin{align*} \sum_{i=1}^{n} x_i &= 1, \quad \text{(Sum Constraint)} \\ x_i &\geq 0, \quad \text{for } i = 1, 2, \ldots, n. \quad \text{(Non-negativity Constraint)} \end{align*}
I came across a UMAP projections of such a space in the literature and I'm attempting to replicate those results. Unfortunately, there isn't much information available on the specific parameters used to create those plots. As a result, my UMAP projections seem to be somewhat distorted. I'm seeking ways to improve and accurately recreate the desired visualization.
Changing the number of neighbors or the seed does not significantly change the overall result.
The reference plot is:
My plot is however:
The corresponding code is:
import numpy as np
from matplotlib import pyplot as plt
from scipy.special import comb
from umap import UMAP
def simplex_grid(m, n):
L = comb(n + m - 1, m - 1, exact=True)
out = np.empty((L, m), dtype=int)
x = np.zeros(m, dtype=int)
x[m - 1] = n
out[0, :] = x[:]
h = m
for i in range(1, L):
h -= 1
val = x[h]
x[h] = 0
x[m - 1] = val - 1
x[h - 1] += 1
out[i, :] = x[:]
if val != 1:
h = m
return out
grid = np.array(simplex_grid(6, 14)) / 14
reducer = UMAP(random_state=10, n_neighbors=80, target_metric="l2",
min_dist=0.05)
trans_grid = reducer.fit_transform(grid)
fig = plt.scatter(trans_grid[:, 0], trans_grid[:, 1], c=grid[:, 0])
ax = plt.gca()
ax.set_aspect('equal', 'box')
plt.axis('off')
fig.axes.get_xaxis().set_visible(False)
fig.axes.get_yaxis().set_visible(False)
plt.show()