View source: R/weighted_jaccard.R
| c_weighted_jaccard_sparse | R Documentation |
Compute the weighted Jaccard similarity matrix for a
dgCMatrix, returning a
sparse result. Uses weighted_jaccard_sparse_fill to compute min-sums
only for column (or row) pairs that share at least one non-zero feature, then
normalises to similarity. Only the upper triangle is computed, taking
advantage of the symmetry of the Jaccard index.
c_weighted_jaccard_sparse(
x,
transpose = FALSE,
display_progress = TRUE,
threads = NULL,
triangle = FALSE,
distance = FALSE
)
x |
A dgCMatrix (sparse column-compressed matrix) |
transpose |
If |
display_progress |
Whether to show a text progress bar (default
|
threads |
Number of threads for parallel computation. The default
|
triangle |
If |
distance |
If |
A sparse similarity (or distance) matrix: dsCMatrix when
triangle = TRUE, dgCMatrix otherwise.
c_weighted_jaccard_dense for the dense equivalent
## Not run:
library(Matrix)
m <- sparseMatrix(i = c(1,2,1,2,3,3), j = c(1,1,2,2,2,3),
x = c(4,2,1,3,3,1), dims = c(3,3))
c_weighted_jaccard_sparse(m)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.