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

List of metrics not allowed if X is a matrix. #20

Closed
OuNao opened this issue Feb 15, 2019 · 3 comments
Closed

List of metrics not allowed if X is a matrix. #20

OuNao opened this issue Feb 15, 2019 · 3 comments

Comments

@OuNao
Copy link

OuNao commented Feb 15, 2019

List of metrics not allowed if X is a matrix.

I tried the option metric=list("cosine"=1:27, "categorical"=28) on my data (matrix with dimnames) and got this error:

Error in match.arg(metric, c("euclidean", "cosine", "manhattan", "hamming", : 'arg' should be one of “euclidean”, “cosine”, “manhattan”, “hamming”, “precomputed”

If I set X=as.data.frame(mydata) the error is gone.

Thanks.

@OuNao
Copy link
Author

OuNao commented Feb 15, 2019

Maybe this line:
https://github.com/jlmelville/uwot/blob/master/R/uwot.R#L1089
Could be:
if (methods::is(X, "data.frame") || methods::is(X, "matrix")) {

@jlmelville
Copy link
Owner

Thanks for the report. I have added the fix to master.

To be on the safe side, I would always recommend converting X to a data frame and explicitly converting any column you want to be treated as categorical to a factor.

@jlmelville
Copy link
Owner

Pretty sure this is fixed. Please re-open if not.

yuhanH pushed a commit to yuhanH/uwot that referenced this issue Jul 20, 2020
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

2 participants