biocore / biocore/gemelli

Misorder labels from contructed tensor after tensor factorization

Open
#41 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
92
Forks
20
PR merge metrics
No merged PRs in 30d

Description

Hey @cameronmartino, @gwarmstrong,
Thanks for this awesome tool.

I was concerned about the sorting procedure for loadings when fitting tensor factorization, would it cause misorder of loading labels in the `label` step?

_Codes of sorting procedure excerpted from `factorization.py` line 219 - 224 in `_fit` function_

```
# save array of loadings for subjects
self.subjects = loads[0].copy()
self.subjects = self.subjects[self.subjects[:, 0].argsort()]
# save array of loadings for features
self.features = loads[1].copy()
self.features = self.features[self.features[:, 0].argsort()]
```
_Codes of labeling step excerpted from `factorization.py` since line 335 in `label` function_

```
# DataFrame single non-condition dependent loadings
self.subjects = pd.DataFrame(self.subjects,
columns=self.biplot_labels,
index=construct.subject_order) # self.subjects reordered, but construct.subject_order didn't
self.features = pd.DataFrame(self.features,
columns=self.biplot_labels,
index=construct.feature_order) # self.features reordered, but construct.feature_order didn't
......
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in factorization.py at _fit around lines 219–224 and then follow the label function from line 335. Compare the sorting of self.subjects and self.features with construct.subject_order and construct.feature_order, using a tensor-factorization example to inspect the resulting labels. Done means labels remain aligned with their loading rows after factorization and labeling.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.