lmcinnes / lmcinnes/umap

AlignedUMAP ignores n_components parameter

Open
#575 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.3k
Forks
871
Avg merge
1d 13h
Merged PRs (30d)
5

Description

Hi,
AlignedUMAP produces a sequence of 2-dimensional embeddings regardless of the n_components' parameter value.
Here's some code taken from this page to demonstrate this.

import numpy as np
import sklearn.datasets
import umap
import umap.plot
import umap.utils as utils
import umap.aligned_umap

digits = sklearn.datasets.load_digits()
ordered_digits = digits.data[np.argsort(digits.data.sum(axis=1))]
ordered_target = digits.target[np.argsort(digits.data.sum(axis=1))]
slices = [ordered_digits[150 * i:min(ordered_digits.shape[0], 150 * i + 400)] for i in range(10)]
relation_dict = {i+150:i for i in range(400-150)}
relation_dicts = [relation_dict.copy() for i in range(len(slices) - 1)]

aligned_mapper_3D = umap.AlignedUMAP(n_components=3).fit(slices, relations=relation_dicts)
aligned_mapper_3D.embeddings_[0].shape

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example from aligned_umap_basic_usage.html with umap.AlignedUMAP(n_components=3), then inspect the umap.AlignedUMAP entry point and how embeddings_ is produced. Done means embeddings_[0] and the other aligned embeddings use the requested component count rather than always having two dimensions.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python, scikit-learn
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.