lmcinnes / lmcinnes/umap

Multiple real valued labels

Open
#145 10 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,

I'm working on a regression problem with multiple real valued targets. An exception is thrown by UMAP (attached below). I assume that it happens because I'm passing a multidimensional array as labels. Am I doing something wrong or is this mode not supported by the algorithm/implementation?

Thanks for everything!

Edit: After digging into the parameters for umap I found `target_metric` which I set to `'l2'`, but I still get an error when my target has shape `(n_samples, n_targets)`

```
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in ()

/usr/local/lib/python3.5/dist-packages/umap/umap_.py in fit_transform(self, X, y)
1521 Embedding of the training data in low-dimensional space.
1522 """
-> 1523 self.fit(X, y)
1524 return self.embedding_
1525

/usr/local/lib/python3.5/dist-packages/umap/umap_.py in fit(self, X, y)
1440 far_dist = 1.0e12
1441 self.graph_ = categorical_simplicial_set_intersection(
-> 1442 self.graph_, y, far_dist=far_dist
1443 )
1444 else:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
```

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

Start in umap_.py at fit(X, y), where categorical_simplicial_set_intersection receives the target labels. Reproduce the failure with y shaped (n_samples, n_targets) and target_metric='l2', then determine the expected handling for multiple real-valued targets. Done means this input no longer raises the ambiguous-array truth-value error and its behavior is covered by an appropriate regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.