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 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 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 added a commit that referenced this issue Feb 15, 2019
@jlmelville
Copy link
Owner

@jlmelville jlmelville commented Feb 15, 2019

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

@jlmelville jlmelville commented Apr 13, 2019

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

@jlmelville jlmelville closed this Apr 13, 2019
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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.