betaFeedback

WorksComputer Science

NFMap: Topographic 2D Manifold Learning with Invertible Normalizing Flows

Abstract

We present NFMap, a dimensionality reduction method for 2D visualisation that extends Generative Topographic Mapping (GTM) with a bijective normalizing flow. Like GTM, NFMap places a fixed mixture grid prior over a 2D latent map, giving a parametric embedding, an explicit likelihood, and the ability to project new points onto an existing map; the likelihood is an effective out-of-distribution signal on chemical datasets. Unlike GTM, whose latent-to-data mapping is an RBF network of bounded flexibility, NFMap's mapping is a normalizing flow, and is therefore fully invertible: any location on the map can be carried back to data space. To alleviate map crowding on large datasets, NFMap additionally supports heavy-tailed Student-t mixture components. NFMap maps data to a latent space of the same dimension, split into a 2-dimensional navigable map and an off-manifold residual. Because the flow is bijective and its objective penalises volume contraction, variance squeezed out of the residual must reappear in the navigable map. The residual scale is the main control between local neighbourhood fidelity and global distance fidelity; its effect depends on the dimensionality of the data and is coupled to the extent of the latent grid.

Introduction

Neighbour-embedding methods such as t-SNE [1] and UMAP [2] preserve local structure well and are the default in most pipelines. However, they are non-invertible. Their standard versions are non-parametric, but both have parametric counterparts [3, 4].

Generative topographic mapping [5] (GTM) fits a constrained Gaussian mixture whose centres lie on a fixed 2-D grid, giving a parametric, probabilistic, out-of-sample-capable map. It is the direct ancestor of this work and remains strong on global structure. Its limit is representational: the latent-to-data mapping is an RBF network, so flexibility is bounded by the basis, and the mapping is not invertible.

Normalizing flows [6, 7, 8, 9, 10] give exact likelihoods and invertible mappings but are not designed to produce a navigable low-dimensional map — their latent space has the same dimension as the data. Injective variants target density estimation on manifolds [9] rather than visualisation. Some flows put the main structure in their first few latent coordinates [11, 12], but they are built for density estimation, not 2-D visualisation.

This work combines GTM’s fixed grid prior with a flow’s invertibility and exact likelihood, exposing a scalar governing how much of the data’s variance is forced into the visible map.

Preprint.

Closest to NFMAP is FloDR [13], developed independently and concurrently1. Both methods use a bijective normalizing flow whose leading coordinates form the 2D map while the remaining coordinates are retained as a residual, ensuring full invertibility and exact density evaluation. The two methods diverge in prior design and residual handling: NFMAP anchors the map prior to a fixed topographic grid and regulates the residual via a global scale σ⊥\sigma_{\perp}, whereas FloDR fits an unconstrained Gaussian mixture to the embedding after training and models the residual conditionally to derive local spread diagnostics. Furthermore, while FloDR relies on an explicit ordinal ranking loss to preserve global ordering, NFMAP obtains global distance fidelity geometrically, through residual variance contraction. NFMAP additionally offers a Student-t mixture prior for large-scale map crowding.

We provide NFMAP as an open-source Python package available at https://github.com/hagax8/nfmap.

Contributions:

  1. The residual scale σ⊥\sigma_{\perp} as a control on the map, with a volume argument showing why, under a bijection, contracting z⊥z_{\perp} forces structure into the visible coordinates z∥z_{\parallel}.

  2. Empirical evidence that σ⊥\sigma_{\perp} trades local against global structure.

  3. A coupling analysis showing that σ⊥\sigma_{\perp}, the grid extent, the repulsion weight and the graph weight all act on one quantity.

  4. The flow likelihood as an applicability-domain signal for projected data points.

  5. Mechanisms to address map crowding at dataset scale: a general heavy-tailed Student-t prior over the map coordinates, and a domain-specific hierarchical chemical kernel demonstrating the framework’s extensibility to specialized data types.

ParametricInvertibleExact densityLandscape gridStudent-t
t-SNE✓*✗✗✗✓
UMAP✓*✗✗✗✗
GTM✓✗✓✓✗
FloDR✓✓✓✗†✗
NFMAP✓✓✓✓✓‡

Table 1. Capabilities of each method. Parametric: unseen points can be projected onto an existing map. Landscape grid: the prior places KK components at fixed, known positions, so any quantity can be aggregated per node and rendered as a continuous background field at a resolution set by KK. Student-t: the low-dimensional model uses Student-t tails, a standard remedy for crowding (built into t-SNE’s similarity kernel, and available in NFMAP as a Student-t mixture prior). UMAP’s kernel, also used by FloDR, is heavy-tailed but not Student-t.

Methods

Architecture

Let x∈RD\mathbf{x} \in\mathbb{R}^{D} be an input observation. NFMAP first maps the data to a PCA-reduced representation of dimension dd (x~∈Rd\tilde{\mathbf{x}} \in\mathbb{R}^{d}), then learns a bijection fθ:Rd→Rdf_{\theta} : \mathbb{R}^{d} \to\mathbb{R}^{d} built from BB affine coupling blocks [8]. Block bb partitions its input by a binary mask mb\mathbf{m}_{b} and applies

z(b+1)=z(b)⊙exp⁡(sb)+tb,(sb,tb)=(1−mb)⊙gθb(mb⊙z(b)),(1)\mathbf{z}^{(b+1)} = \mathbf{z}^{(b)} \odot\exp(\mathbf{s}_{b}) + \mathbf{t}_{b}, \qquad(\mathbf{s}_{b}, \mathbf{t}_{b}) = (1-\mathbf{m}_{b}) \odot g_{\theta_b}(\mathbf{m}_{b} \odot\mathbf{z}^{(b)}), \tag*{(1)}

where gθbg_{\theta_b} is a two-hidden-layer GELU network and sb←tanh⁡(sb)\mathbf{s}_{b} \leftarrow\tanh(\mathbf{s}_{b}) bounds the log-scale for numerical stability. The final layer of each gθbg_{\theta_b} is zero-initialised, so the flow begins as the identity. The log-determinant of the full map is the sum of the block terms, log⁡∣det⁡∂fθ∂x~∣=∑b1Tsb\log\left|\det\frac{\partial f_{\theta}}{\partial\tilde{\mathbf{x}}}\right| = \sum_b \mathbf{1}^{\mathsf{T}}\mathbf{s}_{b}, and the mapping is invertible in closed form.

The latent vector is partitioned into a two-dimensional map and an off-manifold residual,

z=fθ(x~)=(z∥,z⊥),z∥∈R2,z⊥∈Rd−2.(2)\mathbf{z} = f_{\theta}(\tilde{\mathbf{x}}) = (\mathbf{z}_{\parallel}, \mathbf{z}_{\perp}), \qquad\mathbf{z}_{\parallel} \in\mathbb{R}^{2}, \qquad\mathbf{z}_{\perp} \in\mathbb{R}^{d-2}. \tag*{(2)}

Only z∥\mathbf{z}_{\parallel} is plotted; z⊥\mathbf{z}_{\perp} is retained, so no information is discarded and fθ−1f_{\theta}^{-1} reconstructs x~\tilde{\mathbf{x}} exactly.

Prior

The prior factorises over the two blocks, combining a mixture model over the 2D map with a Gaussian penalty on the residual:

p(z)=pmap(z∥)N(z⊥;0,σ2I⊥).(3)p(\mathbf{z}) = p_{\mathrm{map}}(\mathbf{z}_{\parallel}) \mathcal{N}(\mathbf{z}_{\perp}; \mathbf{0}, \sigma^{2}\mathbf{I}_{\perp}). \tag*{(3)}

For the map prior pmapp_{\mathrm{map}}, the standard construction is a Gaussian Mixture Model (GMM):

pGMM(z∥)=∑k=1KπkN(z∥;μk,s2I2).(4)p_{\mathrm{GMM}}(\mathbf{z}_{\parallel}) = \sum_{k=1}^{K} \pi_{k}\mathcal{N}(\mathbf{z}_{\parallel}; \boldsymbol{\mu}_{k}, s^{2}\mathbf{I}_{2}). \tag*{(4)}

Alternatively, to address map crowding in larger datasets (where heavy-tailed distributions better accommodate moderate similarities), we replace the Gaussian components with Student-t distributions of ν\nu degrees of freedom to form a Student-t Mixture Model (SMM):

pSMM(z∥)=∑k=1KπkT(z∥;μk,s2I2,ν).(5)p_{\mathrm{SMM}}(\mathbf{z}_{\parallel}) = \sum_{k=1}^{K} \pi_{k}\mathcal{T}(\mathbf{z}_{\parallel}; \boldsymbol{\mu}_{k}, s^{2}\mathbf{I}_{2}, \nu). \tag*{(5)}

Following GTM [5], in this paper, the component means {μk}\{\boldsymbol{\mu}_{k}\} are fixed on a regular grid of radius grid_bounds and are not learned (although the option exists in NFMAP), and the mixing weights are uniform, πk=1/K\pi_{k} = 1/K. Fixing πk\pi_{k} matters: it denies the model the option of explaining the data by reweighting which nodes are used, so the only available mechanism is warping how points land across the grid. We use K=100K = 100 and, for the Gaussian prior, s=e−1≈0.368s = e^{-1} \approx0.368 throughout, a square grid for manifold datasets, and a hexagonal grid for others.

Objective

Training minimises

L=−λplog⁡pmap(z∥)+12σ21d−2∥z⊥∥2−λvdlog⁡∣det⁡∂fθ∂x~∣+λg(Lattr+λrLrep)+λinjLinj.(6)\mathcal{L} = -\lambda_{p}\log p_{\mathrm{map}}(\mathbf{z}_{\parallel}) + \frac{1}{2\sigma^{2}}\frac{1}{d-2}\lVert\mathbf{z}_{\perp}\rVert^{2} - \frac{\lambda_{v}}{d}\log\left|\det\frac{\partial f_{\theta}}{\partial\tilde{\mathbf{x}}}\right| + \lambda_{g}(\mathcal{L}_{\mathrm{attr}} + \lambda_{r}\mathcal{L}_{\mathrm{rep}}) + \lambda_{\mathrm{inj}}\mathcal{L}_{\mathrm{inj}}. \tag*{(6)}

The graph and injectivity terms act on z∥\mathbf{z}_{\parallel} only. Neighbour weights wijw_{ij} come from UMAP’s fuzzy simplicial set [2] over the input space:

Lattr=E(i,j)∈E[wijlog⁡(1+∥z∥i−z∥j∥2)],(7)\mathcal{L}_{\mathrm{attr}} = \mathbb{E}_{(i,j)\in E}\left[w_{ij}\log\left(1+\lVert\mathbf{z}_{\parallel i}-\mathbf{z}_{\parallel j}\rVert^{2}\right)\right], \tag*{(7)}
Lrep=E(i,j)∼U[log⁡(1+1∥z∥i−z∥j∥2+ϵ)],(8)\mathcal{L}_{\mathrm{rep}} = \mathbb{E}_{(i,j)\sim\mathcal{U}}\left[\log\left(1+\frac{1}{\lVert\mathbf{z}_{\parallel i}-\mathbf{z}_{\parallel j}\rVert^{2}+\epsilon}\right)\right], \tag*{(8)}
Linj=E(i,j)∼B[exp⁡(−∥z∥i−z∥j∥2τ2)∥x~i−x~j∥].(9)\mathcal{L}_{\mathrm{inj}} = \mathbb{E}_{(i,j)\sim\mathcal{B}}\left[\exp\left(-\frac{\lVert\mathbf{z}_{\parallel i}-\mathbf{z}_{\parallel j}\rVert^{2}}{\tau^{2}}\right)\lVert\tilde{\mathbf{x}}_{i}-\tilde{\mathbf{x}}_{j}\rVert\right]. \tag*{(9)}

where (i,j)∼U(i,j) \sim\mathcal{U} are uniform non-neighbour pairs drawn from the batch, and (i,j)∼B(i,j) \sim\mathcal{B} denotes all pairs within the mini-batch. While repulsion acts as a global force preventing map collapse, the injectivity term is strictly local: by weighting a short-range Gaussian kernel (τ=1.0\tau= 1.0, fixed) by ambient distance, it penalises false neighbours without fighting true neighbours.

(6) is a weighted objective rather than a likelihood. The manifold term uses the mean over residual coordinates rather than the sum a Gaussian negative log-likelihood would give, which scales it by 1/(d−2)1/(d-2); and the volume term is scaled by 2/d2/d, which prevents the flow from inflating the log-determinant reward by stretching the d−2d-2 residual dimensions without bound. These two choices largely compensate one another2. We use λp=0.1\lambda_p = 0.1, λv=1\lambda_v = 1, λg=5\lambda_g = 5, λr=1\lambda_r = 1, λinj=0.5\lambda_{\mathrm{inj}} = 0.5, τ=1.0\tau= 1.0, ϵ=10−4\epsilon= 10^{-4} (λinj=0\lambda_{\mathrm{inj}} = 0 in the scale study).

The mechanism

The residual term contributes gradient pressure on z⊥z_\perp scaling as σ⊥−2\sigma_\perp^{-2}. Because fθf_\theta is bijective and the volume term penalises contraction / collapse, variance removed from z⊥z_\perp cannot vanish: it reappears in z∥z_\parallel. Decreasing σ⊥\sigma_\perp therefore forces more of the data’s geometry into the two visible dimensions, improving global distance fidelity at the cost of local neighbourhood fidelity.

Two consequences follow. First, the effect is bounded by how much variance there is to move: when the residual is low-dimensional there is no reservoir, and shrinking σ⊥\sigma_\perp instead destroys the dimension that legitimately carries the manifold’s thickness. Second, if z∥z_\parallel is bounded by a grid of fixed radius, the variance pushed into the map needs canvas to occupy, and the map may simply spill outside the grid boundaries.

Optimisation

Parameters are fitted with AdamW (learning rate 10−310^{-3}, linear warm-up followed by cosine decay) for at most 1000 epochs with early stopping on the training objective (patience 100; 300 epochs and patience 30 in the scale study). We use B=6B = 6 coupling blocks and a hidden width of max⁡(64,min⁡(3d,512))\max(64,\min(3d,512)).

Benchmark design

Datasets

We evaluate our method across three diverse dataset families. The first family comprises five chemical datasets: BACE, BBBP, and ESOL from MoleculeNet [14], alongside ChEMBL [15] activity sets for DRD2 and EGFR. Molecules are represented by 2048-bit Morgan fingerprints (r=2r = 2) concatenated with eight standard physicochemical descriptors (computed via RDKit [16]). High-dimensional features are standardised, reduced to d=32d = 32 principal components (or d=128d = 128 for the scale study), and standardised again, while low-dimensional benchmarks retain their original dimension d=Dd = D. The second family consists of standard low-dimensional machine learning benchmarks: Digits, Wine, Breast Cancer, Iris, Two Moons, and Concentric Circles. The third family comprises synthetic 3-D manifolds designed to test geometric unfolding: the Swiss Roll, the S-Curve, and a synthetic Severed Sphere. With the exception of the chemical datasets and the severed sphere, all standard benchmarks and manifolds are generated or sourced using scikit-learn [17]. Experiments use a 600-sample subset of each dataset, each configuration is fitted across three random seeds (five in the prior ablation), and we report the mean metric. A separate scale study (§ 4.7) uses larger full-scale ChEMBL activity sets: DRD2 (869 molecules), hERG (9,400) and EGFR (10,573), because the crowding effects it examines are properties of large maps and are invisible at the subsample size used above. For that experiment, we use 128 principal components instead of 32, which is closer to what would be used in production cheminformatics pipelines.

Baselines and Implementation

For our baseline comparisons, we use the scikit-learn [17] implementation of t-SNE. For UMAP, we use the official umap-learn [2] Python package. Finally, for Generative Topographic Mapping (GTM), we use the ugtm package [18] implementation. All baseline models receive the exact same PCA-reduced input matrices as NFMap.

Metrics

Let xi\mathbf{x}_i denote inputs and zi∈R2\mathbf{z}_i \in\mathbb{R}^{2} their map coordinates, with dijXd_{ij}^{X} and dijZd_{ij}^{Z} the corresponding pairwise distances.

Global structure. Distance correlation is the Pearson correlation between the two distance vectors,

DistCor⁡=∑i<j(dijX−dˉX)(dijZ−dˉZ)∑i<j(dijX−dˉX)2∑i<j(dijZ−dˉZ)2.(10)\operatorname{DistCor} = \frac{\sum_{i<j}(d_{ij}^{X}-\bar{d}^{X})(d_{ij}^{Z}-\bar{d}^{Z})}{\sqrt{\sum_{i<j}(d_{ij}^{X}-\bar{d}^{X})^{2}\sum_{i<j}(d_{ij}^{Z}-\bar{d}^{Z})^{2}}}. \tag*{(10)}

Local structure. We use trustworthiness and continuity [19]. With NkX(i)\mathcal{N}_{k}^{X}(i) and NkZ(i)\mathcal{N}_{k}^{Z}(i) the kk-neighbourhoods of ii in the two spaces and r(i,j)r(i,j) the rank of jj among ii’s input-space neighbours,

T(k)=1−2nk(2n−3k−1)∑i=1n∑j∈NkZ(i)∖NkX(i)(r(i,j)−k),(11)T(k) = 1 - \frac{2}{nk(2n-3k-1)}\sum_{i=1}^{n}\sum_{j \in\mathcal{N}_{k}^{Z}(i)\setminus\mathcal{N}_{k}^{X}(i)}(r(i,j)-k), \tag*{(11)}

with continuity C(k)C(k) defined symmetrically by exchanging the two spaces. We report their harmonic mean, T/C F1=2TC/(T+C)T/C\ F1 = 2TC/(T+C), at k=5k = 5.

Geodesic structure. On a manifold that folds back on itself, Eq. (10) compares against ambient distances and therefore rewards a map that leaves the manifold rolled. For the synthetic manifold datasets we build a kk-nearest-neighbour graph (k=10k = 10) on the input and take all-pairs shortest paths gijg_{ij} [20], reporting DistCor⁡geo\operatorname{DistCor}_{\mathrm{geo}} as Eq. (10) with dijXd_{ij}^{X} replaced by gijg_{ij}.

Chemical structure. For chemistry we also measure whether molecules sharing a Bemis–Murcko scaffold remain together. With cic_i the scaffold identifier of molecule ii and E={i:∣{j≠i:cj=ci}∣≥1}\mathcal{E} = \{i : |\{j \ne i : c_j = c_i\}| \ge1\} the molecules whose scaffold has at least one other member,

purity⁡@k=1∣E∣∑i∈E1k∣{j∈NkZ(i):cj=ci}∣.(12)\operatorname{purity}@k = \frac{1}{|\mathcal{E}|}\sum_{i \in\mathcal{E}}\frac{1}{k}\left|\{j \in\mathcal{N}_{k}^{Z}(i) : c_j = c_i\}\right|. \tag*{(12)}

Singleton scaffolds are excluded: they can never have a same-scaffold neighbour. We report purity against the chance rate 1∣E∣∑i∈E(∣ci∣−1)(n−1)\frac{1}{|E|}\sum_{i\in E}\frac{(|c_i|-1)}{(n-1)}. We also report the silhouette coefficient over map coordinates with cic_i as the label, restricted to the same EE, which captures separation between scaffold groups rather than only neighbourhood composition.

Density as an applicability domain. NFMAP yields an exact data density log⁡p(x)\log p(x). We assess it as an out-of-distribution score by the area under the ROC curve separating held-out in-distribution points from out-of-distribution ones, against two baselines: mean distance to the kk nearest training points, and PCA reconstruction error.

Experiments

  1. σ⊥\sigma_\perp as a local/global control: Examining the effect of the residual variance parameter across different dataset geometries.

  1. Graph loss weights: Examining how the attraction and repulsion weights provide further control on map spread.

  1. Joint σ⊥×\sigma_\perp\times grid_bounds sweep: Sweeping eight values of σ⊥\sigma_\perp spanning four orders of magnitude against three grid radii (6, 12, 24) on the chemical datasets to reveal parameter coupling (Figure 3).

Joint sweep on the chemical datasets

Figure 3. Joint sweep on the chemical datasets. Hatched cells violate the containment constraint.

  1. Comparison at matched tuning: Each method is swept over its own local/global control (14 values of σ⊥\sigma_\perp from 10−310^{-3} to 10310^{3} with grid_bounds 12 and 24 for NFMAP, perplexity for t-SNE (5–500), n_neighbors and min_dist for UMAP) and compared at its best setting.

  1. Prior ablation: Testing a single Gaussian, a learned mixture, and our fixed grid to measure the cost of the structural constraint.

  1. Applicability domain: Up to three out-of-distribution constructions (feature-permuted inputs and matched-moment Gaussian noise for every dataset; held-out novel classes where there are at least three classes) across fourteen datasets using exact likelihood.

  1. Scale study and domain extensions: Evaluating the hierarchical chemical kernel and Student-t prior on larger DRD2, hERG and EGFR ChEMBL datasets, including a degrees-of-freedom sweep.

Results

σ⊥\sigma_\perp is a local/global control whose direction depends on the data

Shrinking σ⊥\sigma_\perp transfers variance into the map, improving global distance fidelity at the cost of neighbourhood fidelity; but only where the residual has variance to give. Figure 1 shows the two regimes on one axis: on chemistry (d⊥≈30d_\perp\approx30) DistCor falls from 0.73 to 0.21 as σ⊥\sigma_\perp rises, whereas on the 3-D manifolds (d⊥=1d_\perp= 1) it rises from 0.67 and flattens near 0.73. The curves cross. With one off-manifold dimension there is no reservoir to redistribute, and shrinking σ⊥\sigma_\perp instead destroys the dimension carrying the manifold’s thickness.

DistCor trade-off for chemistry and 3-D manifolds

Figure 1. The direction of the σ⊥\sigma_\perp trade-off is set by the data’s geometry. Mean ±\pm s.d. over datasets and three seeds, grid_bounds = 12.

The graph loss terms (attraction and repulsion) control map spread

In addition to σ⊥\sigma_{\perp} and the grid radius, the graph loss weights provide further control over embedding geometry (Figure 2).

Ablation plots of graph attraction and repulsion weights

Figure 2. Ablation of the graph attraction (λg\lambda_g) and repulsion (λr\lambda_r) weights. The graph terms act as opposing forces on the map’s spread relative to the canvas.

The attraction term is strictly necessary to produce a usable map: at λg=0\lambda_g = 0, local neighbourhood fidelity (T/C F1) drops for all dataset families, indicating that the prior and volume terms alone are insufficient to preserve structure.

Both graph terms act as additional handles on the same underlying quantity: the spread of the 2-D coordinates relative to the fixed grid canvas. Stronger attraction (λg\lambda_g) contracts the map, effectively halving the fraction of out-of-bounds points on manifold datasets. Conversely, the repulsion term (λr\lambda_r) acts as an anti-collapse mechanism that expands the map.

σ⊥\sigma_\perp cannot be chosen independently of the grid

Figure 3 sweeps σ⊥\sigma_\perp and grid_bounds together. Widening the canvas from 6 to 12 allows σ⊥\sigma_\perp an order of magnitude lower (for high-dimensional datasets); the wider grid absorbs the redistributed variance. In this example, the best shared “global” configuration (optimizing DistCor) keeping ≥95%\ge95\% of points inside the grid is σ⊥=0.003\sigma_\perp= 0.003, grid_bounds = 12. The gain saturates: widening further to grid_bounds = 24 does not admit σ⊥=0.001\sigma_\perp= 0.001 within the containment constraint and lowers mean DistCor slightly (0.65 vs. 0.68), so the shared optimum sits at the intermediate grid.

Comparison with existing methods

On global structure, t-SNE at high perplexity is the strongest baseline on most datasets. NFMAP has the best global fidelity on ESOL, ties t-SNE on Iris, and is above UMAP on all five chemical sets, while its local fidelity stays within 0.06 of the best method throughout. It trails t-SNE and UMAP on the geodesic structure of the Swiss roll. Unlike either, it does this with an invertible map. For t-SNE, the global-structure optimum lies at a perplexity approaching the sample size, which is impractical at realistic nn.

Figure 4 and Figure 5 show maps for DRD2 and the S-curve. For S-curve, we used the best geodesic setup for every map; for DRD2, we show two extreme settings for NFMAP, with σ⊥=0.003\sigma_{\perp} = 0.003 (global-optimizing) and σ⊥=10\sigma_{\perp} = 10 (local-optimizing).

DRD2 at both ends of the $\sigma_{\perp}$ dial, against GTM, t-SNE and UMAP

Figure 4. DRD2 at both ends of the σ⊥\sigma_{\perp} dial, against GTM, t-SNE and UMAP.

S-curve: all methods, showing NFMAP, GTM, t-SNE, and UMAP scatter plots

Figure 5. S-curve. NFMap and baselines at their Table 2 settings.

The fixed grid does not harm performance

Fixing the grid (Table 3, Figure 6) is statistically non-inferior to learning the mixture means, for both DistCor (margin 0.02; one-sided paired tt-test, p=8×10−6p = 8 \times10^{-6}) and T/C F1 (margin 0.01; p=9×10−11p = 9 \times10^{-11}), over 43 paired runs on 9 datasets. We therefore adopt the fixed grid for the canonical grid cells it provides.

Three panels showing the prior over the NFMAP coordinates for digits: Single Gaussian, Learned mixture, and Fixed grid (NFMAP)

Figure 6. The prior over the NFMAP coordinates, on digits (n=600n = 600, 64 features, coloured by digit). Left: a single Gaussian. Middle: a mixture of 100 components whose means are learned. Right: the same mixture with its means pinned to a fixed hexagonal grid. Crosses mark the mixture means after training: the learned means leave the lattice and gather in the clusters, while the fixed ones stay where they were placed. All three panels at grid_bounds = 6 and σ⊥=10\sigma_{\perp} = 10. DistCor, T/C F1 and silhouette under each panel are means over 3 seeds.

PriorDistCorT/C F1Off grid
Digits
Single Gaussian0.648±0.0020.648 \pm0.0020.963±0.0040.963 \pm0.004–
Learned mixture0.624±0.0050.624 \pm0.0050.973±0.0020.973 \pm0.0020.0%
Fixed grid (NFMAP)0.608±0.0100.608 \pm0.0100.973±0.0030.973 \pm0.0030.9%
Chemistry (5 datasets)
Single Gaussian0.657±0.0900.657 \pm0.0900.848±0.0490.848 \pm0.049–
Learned mixture0.679±0.0860.679 \pm0.0860.856±0.0500.856 \pm0.05012.0%
Fixed grid (NFMAP)0.677±0.0950.677 \pm0.0950.858±0.0500.858 \pm0.0503.0%
3-D manifolds (3 datasets)
Single Gaussian0.756±0.0410.756 \pm0.0410.940±0.0240.940 \pm0.024–
Learned mixture0.682±0.0480.682 \pm0.0480.992±0.0100.992 \pm0.0103.1%
Fixed grid (NFMAP)0.719±0.0280.719 \pm0.0280.989±0.0120.989 \pm0.0121.7%

Table 3. Prior ablation across datasets and seeds (mean ±\pm sd; 3 seeds for Digits, 5 seeds for the other datasets). Against a single Gaussian the fixed grid gives equal or better T/C F1 and trades some DistCor on Digits and the 3-D manifolds. Off grid: share of points outside grid_bounds (also an average across datasets and seeds). A single Gaussian has no grid, so off-grid is not reported.

The likelihood is an applicability-domain signal

Figure 7 reports out-of-distribution AUC. NFMAP’s exact log-likelihood leads the kk-NN distance baseline on every chemical dataset (mean 0.937 versus 0.896). On the non-chemical sets it trails on average (0.834 versus 0.880), most clearly on the two-dimensional toys (circles, moons), where d⊥=0d_{\perp} = 0 and the density has no residual to measure; results on the remaining sets are mixed (ahead on wine, cancer, S-curve and severed sphere; behind on digits, iris and swiss roll).

NFMAP's exact log-likelihood as an applicability-domain signal

Figure 7. Out-of-distribution detection AUC, averaged over the applicable OOD constructions (feature-permuted inputs and matched-moment noise for every dataset; held-out novel classes in addition where there are ≥3 classes) and three seeds. Dashed line is chance.

Crowding: effects that appear only at scale

The experiments so far use small datasets (at most n=600n = 600), where crowding is not addressed: in high dimensions, there is far more room at moderate distances than two dimensions can represent, so as nn grows the moderately dissimilar points are increasingly compressed together. At n=600n = 600 there is little crowding to relieve. We investigated the crowding problem in larger chemical datasets, by adding two features: a scaffold-informed hierarchical chemical kernel (Bemis–Murcko scaffold and generic skeleton), and a Student-t prior over the map coordinates (see Figure 8). Replacing the Euclidean graph with the hierarchical kernel raises scaffold silhouette by +0.045 on DRD2 (n=869n = 869), +0.194 on hERG (n=9,400n = 9{,}400) and +0.280 on EGFR (n=10,573n = 10{,}573). On EGFR, a Student-t prior over the map coordinates further raises scaffold purity from 0.571 to 0.63–0.64 and silhouette from −0.023 to between +0.07 and +0.10, with little dependence on the degrees of freedom across ν=2\nu= 2–30. The best EGFR configuration (hierarchical kernel, Student-t, ν=2\nu= 2) reaches scaffold purity 0.642 and silhouette +0.104, against 0.388 and −0.303 for the Euclidean-graph Gaussian baseline.

Crowding remedies at full dataset scale

Figure 8. Crowding remedies at full dataset scale (single seed). Left: replacing the Euclidean neighbourhood graph with the hierarchical chemical kernel, on the complete DRD2, hERG and EGFR activity sets. Right: the Student-t degrees-of-freedom sweep on EGFR, with the Gaussian prior shown for reference.

Discussion

Treating the 2-D map as one half of a bijection, with a volume term that penalises contraction, gives σ⊥\sigma_{\perp} a concrete meaning: it sets how much of the data’s variance the flow may leave in the residual. On high-dimensional data, shrinking it moves geometry onto the map and improves global structure; on thin 3-D manifolds it flattens the dimension that carries the manifold’s thickness. The right setting therefore depends on the data’s geometry rather than being a universal default.

The coupling between σ⊥\sigma_{\perp} and the grid extent also means that grid-based methods should not be tuned one parameter at a time. Chosen jointly, the grid absorbs the redistributed variance, and NFMAP reaches global fidelity close to GTM’s and above UMAP’s on the chemical datasets without spilling points off the canvas. Fixing the grid, rather than learning the mixture means, had no measurable cost in embedding quality.

The flow formulation also gives NFMAP capabilities that neighbour embeddings lack. Its exact likelihood separates in- from out-of-distribution molecules better than a kk-NN distance baseline on all five chemical datasets. At larger scale (up to ∼\sim10,000 molecules), where crowding becomes visible, a Student-t prior and a scaffold-aware kernel each improve scaffold separation, and both fit into the framework without changing the flow.

Conclusions

We introduced NFMAP, an invertible, parametric dimensionality reduction method that combines GTM’s fixed latent grid with the exact likelihood of a normalizing flow. The residual scale σ⊥\sigma_{\perp} controls the local/global trade-off; the direction of its effect depends on the intrinsic dimensionality of the data, and it must be chosen together with the grid extent. Unlike t-SNE and UMAP, NFMAP is fully invertible. It also projects new points onto a trained map, carries any map position back to data space, and its density works as an out-of-distribution signal on chemical data. The fixed grid provides a common reference canvas at no measurable cost in embedding quality. The framework is also easy to extend: a Student-t prior and a hierarchical chemical kernel improve map structure on larger datasets. The main limitations are that several hyperparameters affect how far the map spreads, and that points can fall outside the grid. Adaptive calibration of the grid extent is a natural next step.

Additional Qualitative Results on 3-D Manifolds

In this section, we provide full qualitative map comparisons for the remaining synthetic 3-D benchmark manifolds described in § 3: the Severed Sphere (Figure A.1) and the Swiss Roll (Figure A.2).

All baselines (GTM, t-SNE, and UMAP) are depicted at their highest geodesic distance correlation configurations, matching the evaluation protocol reported in Table 2.

NFMAPGTMt-SNEUMAP
GLGLGLGL
Chemistry
BACE0.370.970.340.960.610.980.300.98
BBBP0.550.890.710.870.590.910.390.92
ESOL0.760.850.700.870.570.890.180.91
DRD20.360.960.420.950.590.960.230.98
EGFR0.440.920.470.910.670.920.340.95
3-D manifolds
Swiss roll0.520.990.260.980.771.000.861.00
S-curve0.940.990.500.990.991.000.991.00
Severed sphere0.921.000.910.990.951.000.951.00
Other
Digits0.630.970.530.970.700.960.590.96
Iris0.980.980.750.950.980.980.910.98
Cancer0.800.930.660.940.810.950.740.96
Wine0.840.940.720.940.860.950.780.96

Table 2. Each method at its own best setting (means over 3 seeds, CPU). G: global structure (DistCor; geodesic DistCor on the 3-D manifolds). L: local structure (T/C F1). Each sweep is reduced to its Pareto front over (G, L); the reported point is the front’s knee, or its maximum-G point on the manifolds. Best per dataset in bold. NFMAP’s reported maps keep at least 99% of points inside grid_bounds, except the S-curve (94%). Settings in Table B.1.

Severed sphere manifold embeddings produced by NFMap, GTM, t-SNE, and UMAP

Figure A.1. Severed sphere manifold embedding. NFMap and baselines at their Table 2 settings.

Swiss roll manifold embedding

Figure A.2. Swiss roll manifold embedding. NFMAP and baselines at their Table 2 settings.

Experimental Settings and Hyperparameters

Table B.1 details the hyperparameter sweep ranges and selected Pareto-optimal configurations for each baseline and dataset family reported in Table 2.

NFMAPt-SNEUMAP
Chemistry
BACE0.30.3 / 242420020055 / 0.990.99
BBBP33 / 242420020055 / 00
ESOL0.010.01 / 242430030055 / 0.10.1
DRD20.30.3 / 242430030055 / 0.50.5
EGFR0.30.3 / 242430030055 / 00
3-D manifolds
Swiss roll33 / 242415151515 / 0.990.99
S-curve100100 / 12125050100100 / 0.50.5
Severed sphere55 / 1212100100400400 / 0.990.99
Other
Digits1010 / 1212400400400400 / 0.50.5
Iris11 / 12121001001515 / 0.10.1
Cancer55 / 12122002001515 / 0.10.1
Wine11 / 1212100100100100 / 0.10.1

Table B.1. Hyperparameters selected by the sweep for each entry of Table 2 (the reported Pareto point; not fixed in advance). NFMAP: σ⊥\sigma_{\perp} / grid_bounds, swept over 14 σ⊥\sigma_{\perp} values from 10−310^{-3} to 10310^{3} and grid_bounds 12 and 24 (number of grid nodes fixed at 100). t-SNE: perplexity. UMAP: n_neighbors / min_dist. GTM: not swept, one configuration (10 × 10 nodes, 6 × 6 RBF centres, RBF width factor 0.3).

References

  1. [1]Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 9(86):2579–2605, 2008. URL http://jmlr.org/papers/v9/vandermaaten08a.html.
  2. [2]Leland McInnes, John Healy, Nathaniel Saul, and Lukas Großberger. Umap: Uniform manifold approximation and projection. Journal of Open Source Software, 3(29):861, 2018. doi: 10.21105/joss.00861. URL https://doi.org/10.21105/joss.00861.
  3. [3]Laurens van der Maaten. Learning a parametric embedding by preserving local structure. In David van Dyk and Max Welling, editors, Proceedings of the Twelfth International Conference on Artificial Intelligence and Statistics, volume 5 of Proceedings of Machine Learning Research, pages 384–391, Hilton Clearwater Beach Resort, Clearwater Beach, Florida USA, 16–18 Apr 2009. PMLR. URL https://proceedings.mlr.press/v5/maaten09a.html.
  4. [4]Tim Sainburg, Leland McInnes, and Timothy Q. Gentner. Parametric umap embeddings for representation and semisupervised learning. Neural Computation, 33(11):2881–2907, 10 2021. ISSN 0899-7667. doi: 10.1162/neco_a_01434. URL https://doi.org/10.1162/neco_a_01434.
  5. [5]Christopher M. Bishop, Markus Svensén, and Christopher K. I. Williams. Gtm: The generative topographic mapping. Neural Computation, 10(1):215–234, 1998. doi: 10.1162/089976698300017953.DOI
  6. [6]George Papamakarios, Eric Nalisnick, Danilo Jimenez Rezende, Shakir Mohamed, and Balaji Lakshminarayanan. Normalizing flows for probabilistic modeling and inference. Journal of Machine Learning Research, 22(57):1–64, 2021.arxiv.org/abs/1912.02762
  7. [7]Danilo Jimenez Rezende and Shakir Mohamed. Variational inference with normalizing flows. In International Conference on Machine Learning (ICML), 2015.arxiv.org/abs/1505.05770
  8. [8]Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real NVP. In International Conference on Learning Representations, 2017. URL https://openreview.net/forum?id=HkpbnH9lx.arxiv.org/abs/1605.08803
  9. [9]Johann Brehmer and Kyle Cranmer. Flows for simultaneous manifold learning and density estimation, 2020. URL https://arxiv.org/abs/2003.13913.
  10. [10]Anthony L. Caterini, Gabriel Looza-Ganem, Geoff Pleiss, and John P. Cunningham. Rectangular flows for manifold learning. In Proceedings of the 35th International Conference on Neural Information Processing Systems, NIPS ’21, Red Hook, NY, USA, 2021. Curran Associates Inc. ISBN 9781713845393.arxiv.org/abs/2106.01413
  11. [11]Artur Bekasov and Iain Murray. Ordering dimensions with nested dropout normalizing flows, 2020. URL https://arxiv.org/abs/2006.08777.
  12. [12]Edmond Cunningham, Adam D Cobb, and Susmit Jha. Principal component flows. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato, editors, Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pages 4492–4519. PMLR, 17–23 Jul 2022. URL https://proceedings.mlr.press/v162/cunningham22a.html.
  13. [13]Abdallah Baraka and Daniel Probst. Flodr: An invertible dimensionality reduction method based on a normalising flow, 2026. URL https://arxiv.org/abs/2607.26278.
  14. [14]Zhenqin Wu, Bharath Ramsundar, Evan N. Feinberg, Joseph Gomes, Caleb Geniesse, Aneesh S. Pappu, Karl Leswing, and Vijay Pande. MoleculeNet: a benchmark for molecular machine learning. Chemical Science, 9(2):513–530, 01 2018. ISSN 2041-6520. doi: 10.1039/c7sc02664a. URL https://doi.org/10.1039/c7sc02664a.
  15. [15]Barbara Zdrazil, Eloy Felix, Fiona Hunter, Emma J Manners, James Blackshaw, Sybilla Corbett, Marleen de Veij, Harris Ioannidis, David Mendez Lopez, Juan F Mosquera, Maria Paula Magarinos, Nicolas Bosc, Ricardo Arcila, Tevfik Kizilor̆en, Anna Gaulton, A Patricia Bento, Melissa F Adasme, Peter Monecke, Gregory A Landrum, and Andrew R Leach. The chembl database in 2023: a drug discovery platform spanning multiple bioactivity data types and time periods. Nucleic Acids Research, 52(D1):D1180–D1192, 01 2024. ISSN 0305-1048. doi: 10.1093/nar/gkad1004. URL https://doi.org/10.1093/nar/gkad1004.
  16. [16]Greg Landrum and others. RDKit: Open-source cheminformatics. https://www.rdkit.org. Accessed: 2026-10-09.
  17. [17]F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.arxiv.org/abs/1201.0490
  18. [18]Hélena Alexandra Gaspar. ugtm: A python package for data modeling and visualization using generative topographic mapping. Journal of Open Research Software, 6(1):29, 2018. doi: 10.5334/jors.235. URL https://doi.org.DOI
  19. [19]Jarkko Venna and Samuel Kaski. Local multidimensional scaling with controlled tradeoff between trust-worthiness and continuity. 2005. URL https://api.semanticscholar.org/CorpusID:16318128.
  20. [20]Joshua B. Tenenbaum, Vin de Silva, and John C. Langford. A global geometric framework for nonlinear dimensionality reduction. Science, 290(5500):2319–2323, 2000. doi: 10.1126/science.290.5500.2319. URL https://www.science.org/doi/abs/10.1126/science.290.5500.2319.DOI

Paper details

vlnc:W_qr3w3ze4
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 4

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents