Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

MethodError: no method matching fit(::Type{MDS}, ::Adjoint{Float64, Matrix{Float64}} #207

Open
zhuxuangao opened this issue Nov 15, 2022 · 3 comments
Labels

Comments

@zhuxuangao
Copy link

zhuxuangao commented Nov 15, 2022

I'm using both MDS and PCA in the package MultivariateStats.jl. My code is

M = fit(PCA, matrix; maxoutdim=2)
Yte = predict(M, matrix)
M1 = fit(MDS, matrix; maxoutdim=2, distances=false)
Yte1 = predict(M1)
Soon I found that Yte and Yte1 are always the same since MDS uses Euclidean norm, so MDS is always equivalent to PCA in this case. Then I tried another method.

mds = fit(MDS, matrix; distances=true, metric=isotonic)
But I got the error that

MethodError: no method matching fit(::Type{MDS}, ::Adjoint{Float64, Matrix{Float64}}; distances=true, metric=MultivariateStats.isotonic) Closest candidates are: fit(::Type{MDS}, ::AbstractMatrix{T}; maxoutdim, distances) where T<:Real at ~/.julia/packages/MultivariateStats/cFZlL/src/cmds.jl:232 got unsupported keyword argument "metric"

I tried MetricMDS instead of MDS, then I got error
UndefVarError: MetricMDS not defined

My version is 1.8.1

I found the example code above in https://juliastats.org/MultivariateStats.jl/dev/mds/#MultivariateStats.MetricMDS

Is there anyway to fix it?

@wildart
Copy link
Collaborator

wildart commented Nov 15, 2022

It's a typo in the docs. Use MetricMDS type as a first parameter instead of MDS, e.g.

mds = fit(MetricMDS, D; distances=true, metric=isotonic)

@wildart wildart added the docs label Nov 15, 2022
@zhuxuangao
Copy link
Author

I tried it, and I got "UndefVarError: MetricMDS not defined"

@wildart
Copy link
Collaborator

wildart commented Nov 15, 2022

What package version are you using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants