question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add inverse_transform() to random projection classes

See original GitHub issue

Describe the workflow you want to enable

GaussianRandomProjection and SparseRandomProjection should have an inverse_transform() method.

Describe your proposed solution

Simply add the inverse_transform() method, with the appropriate input validation and tests, and return X @ np.linalg.pinv(self.components_.T).

Describe alternatives you’ve considered, if relevant

N/A

Additional context

My understanding is that every transformer that performs a reversible transformation should have an inverse_transform() method, unless there’s a really good reason not to (e.g., if it’s terribly inefficient, or there’s a better alternative). Was the inverse_transform() left out because it’s too inefficient?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
adrinjalalicommented, Nov 17, 2021

true, you could open a PR with that approach.

0reactions
ageroncommented, Nov 18, 2021

Done. I named the parameter fit_inverse_transform, like in KernelPCA. I also named the learned pseudo-inverse of the components components_pinv_, for lack of a better idea. I propose to continue the discussion in the PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

6.6. Random Projection — scikit-learn 1.2.0 documentation
When the inverse_transform method is called, it computes the product of the input X and the transpose of the inverse components. If the...
Read more >
Source code for scprep.reduce - Read the Docs
[docs]class InvertibleRandomProjection(random_projection.GaussianRandomProjection): """Gaussian random projection with an inverse transform using the ...
Read more >
Random projections
Random projections are a useful tool in the analysis and processing of high-dimensional data. We will analyze two applications that use random ...
Read more >
Linear Discriminant Analysis inverse transform - Stack Overflow
I try to use Linear Discriminant Analysis from scikit-learn library, in order to perform dimensionality reduction on my data which has more than ......
Read more >
Random Projections and Dimension Reduction - arXiv
One solution to these problems is the use of random projections. Instead of ... given by the inverse Fourier transform of k. For...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found