Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

transform(kpca) returns error #96

Closed
gdkrmr opened this issue May 31, 2019 · 5 comments · Fixed by #97
Closed

transform(kpca) returns error #96

gdkrmr opened this issue May 31, 2019 · 5 comments · Fixed by #97
Labels

Comments

@gdkrmr
Copy link
Contributor

gdkrmr commented May 31, 2019

using MultivariateStats
data = randn(3, 100)
kpca = fit(KernelPCA, data)
transform(kpca) # error
transform(kpca, data) # works 
@wildart wildart added the bug label Jun 1, 2019
@wildart
Copy link
Collaborator

wildart commented Jun 1, 2019

transform(kpca) only works with precomputed kernels. There should be more comprehensive error for this call.

@gdkrmr
Copy link
Contributor Author

gdkrmr commented Jun 2, 2019

How do I get the embedded coordinates of my original data points then?

@wildart
Copy link
Collaborator

wildart commented Jun 3, 2019

As you wrote above:

original = randn(3, 100)
model = fit(KernelPCA, original)
embedded = transform(model, original) 

@gdkrmr
Copy link
Contributor Author

gdkrmr commented Jun 4, 2019

that is quite inefficient, because transform(kpca, X) calculates the kernel matrix again, this could be avoided with:

transform(kpca::KernelPCA) = sqrt.(kpca.λ) .* kpca.α'

wildart added a commit to wildart/MultivariateStats.jl that referenced this issue Jun 4, 2019
@wildart
Copy link
Collaborator

wildart commented Jun 4, 2019

You are right, I completely disregarded that. Fix is coming.

wildart added a commit that referenced this issue Jun 4, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants