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

How to use MetricMDS #231

Open
l8l opened this issue Jun 14, 2024 · 2 comments
Open

How to use MetricMDS #231

l8l opened this issue Jun 14, 2024 · 2 comments

Comments

@l8l
Copy link

l8l commented Jun 14, 2024

This might be a naive question but I am unable to understand how to use metric MDS. When following the examples in the documentation, I only get classical MDS out. In the documentation, an example for classical MDS (cMDS) is provided, using the code

using MultivariateStats
# ... prepare data X ...
M = fit(MDS, X; maxoutdim=3, distances=false)
# returns "Classical MDS(indim = 4, outdim = 3)"

However, no example for metric MDS (mMDS) is given. Scrolling down, there are 2 sections, one explaining cMDS and one mMDS. In the mMDS section, the code provided to call mMDS seems to be the same as for cMDS:

mds = fit(MDS, X; distances=false, maxoutdim=size(X,1)-1)

There is no specification what one has to load before that to make the function return an mMDS object instead of a cMDS object. (Maybe this is also related to me lacking general knowledge of julia?) I tried things like

using MultivariateStats.MetricMDS
mds = fit(MDS, X; distances=false, maxoutdim=size(X,1)-1)

or

using MultivariateStats
mds = fit(MetricMDS, X; distances=false, maxoutdim=size(X,1)-1)

or

using MultivariateStats
mds = fit(MDS::MetricMDS, X; distances=false, maxoutdim=size(X,1)-1)

but all return errors. Is there a problem with the documentation or am I just doing a silly mistake? Thanks a lot!

@l8l
Copy link
Author

l8l commented Jun 30, 2024

Any ideas so far? I would have thought that this might be straightforward to resolve.

@l8l
Copy link
Author

l8l commented Oct 29, 2024

I came back to this now, several months later, and

using MultivariateStats
mds = fit(MetricMDS, X; distances=false, maxoutdim=size(X,1)-1)

does work now. However, this is not reflected in the documentation: https://juliastats.org/MultivariateStats.jl/stable/mds/#MultivariateStats.MetricMDS

The part
"
There are two calling options, specified via the required keyword argument distances:

mds = fit(MDS, X; distances=false, maxoutdim=size(X,1)-1)

where X is the data matrix. Distances between pairs of columns of X are computed using the Euclidean norm. This is equivalent to performing PCA on X.

mds = fit(MDS, D; distances=true, maxoutdim=size(D,1)-1)

where D is a symmetric matrix D of distances between points.
"

seems to have been copied from the classical MDS part of the documentation. MDS needs to be replaced by MetricMDS and the sentence "This is equivalent to performing PCA on X." perhaps also does not hold for the MetricMDS case, and should perhaps be removed?

Overall, this part of the documentation should thus perhaps be modified to

"
There are two calling options, specified via the required keyword argument distances:

mds = fit(MetricMDS, X; distances=false, maxoutdim=size(X,1)-1)

where X is the data matrix. Distances between pairs of columns of X are computed using the Euclidean norm.

mds = fit(MetricMDS, D; distances=true, maxoutdim=size(D,1)-1)

where D is a symmetric matrix D of distances between points.
"

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

No branches or pull requests

1 participant