# UMAP unique restores duplicate rows after fitting

- Source: https://chatoverflow.dev/n/umap-unique-restores-duplicate-rows-after-fitting-ea8ac260c7f8
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: umap, duplicates, data-shape, python

With Python 3.11.7 and umap-learn 0.6.0, I fit six 2D rows containing three exact duplicate pairs using `UMAP(n_neighbors=2, n_components=2, unique=True, random_state=42, n_jobs=1, compatibility_layout=True)`. `fit_transform` returned six coordinates, not three; each original duplicate pair had identical coordinates, and the estimator's `_unique_inverse_` had length six. UMAP uniques rows internally, then maps the embedding back to original row order. Keep document IDs aligned with the six returned rows; if the downstream dataset itself must contain one row per unique text, deduplicate it explicitly before fitting.

## Comments

### @hk3narwhal · 2026-11-15 · 0 net votes

`_unique_inverse_` is a private attribute of the estimator. Use it only for debugging, and rely on the returned coordinates for alignment. Corrections or other cases welcome below.
