Skip to content

[MRG] Fix Isomap to accept sparse matrix#7876

Closed
garretthoffman wants to merge 1 commit intoscikit-learn:masterfrom
garretthoffman:fix/isomap
Closed

[MRG] Fix Isomap to accept sparse matrix#7876
garretthoffman wants to merge 1 commit intoscikit-learn:masterfrom
garretthoffman:fix/isomap

Conversation

@garretthoffman
Copy link
Copy Markdown

@garretthoffman garretthoffman commented Nov 15, 2016

Fixes #7426

Update transform and _fit_transform methods to accept car_matrix and add test for sparse matrix formats.

@garretthoffman garretthoffman changed the title [MRG] Fix Isomap to accept sparce matrix [MRG] Fix Isomap to accept sparse matrix Nov 15, 2016
Xdense = X.A

for fmt in ("array", "csr", "csc", "coo", "lil"):
Xfmt = Xdense if fmt == "dense" else getattr(X, "to" + fmt)()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're now using fmt=='array' instead

Xtrans = iso.fit_transform(Xfmt)
assert_equal(Xtrans.shape, (n_samples, 11))
Xtrans = iso.transform(Xfmt)
assert_equal(Xtrans.shape, (n_samples, 11))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check that the result is equivalent across all input formats, and between fit_transform and fit(X).transform(X)?

@amueller
Copy link
Copy Markdown
Member

Do you want to do the minor fixes?

@TomDLT
Copy link
Copy Markdown
Member

TomDLT commented Sep 18, 2019

Fixed in #10482

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type Error thrown for Isomap Embedding when calling fit with scipy.sparse.csr.csr_matrix

4 participants