koheiw / proxyC

R package for large-scale similarity/distance computation
GNU General Public License v3.0
29 stars 6 forks source link

measure = "simple matching" seems wrong #7

Closed koheiw closed 5 years ago

koheiw commented 5 years ago

simil returns 1 in both cases.

> proxyC::simil(Matrix::Matrix(c(1, 2), nrow = 1, sparse = TRUE),
+               Matrix::Matrix(c(2, 1), nrow = 1, sparse = TRUE), 
+               margin = 1, method = "simple matching")
1 x 1 sparse Matrix of class "dgTMatrix"

[1,] 1
> proxyC::simil(Matrix::Matrix(c(1, 2), nrow = 1, sparse = TRUE),
+               Matrix::Matrix(c(1, 2), nrow = 1, sparse = TRUE), 
+               margin = 1, method = "simple matching")
1 x 1 sparse Matrix of class "dgTMatrix"

[1,] 1
koheiw commented 5 years ago

It is a Boolean measure, so produces different result only a cell is zero. This is probably not very useful but this is how it is.

> proxyC::simil(Matrix::Matrix(c(1, 2), nrow = 1, sparse = TRUE),
+               Matrix::Matrix(c(0, 2), nrow = 1, sparse = TRUE), 
+               margin = 1, method = "simple matching")
1 x 1 sparse Matrix of class "dgTMatrix"

[1,] 0.5