sim_loopR: Generate similarity matrix using different methods

Description Usage Arguments Value Functions

View source: R/similarity.R

Description

A collection of functions that take a numeric / 0-1 integer matrix and calculate row-wise similarity.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
sim_loopR(X, metric, thresh = 0, n_cpu = 1, cl = NA, include_diag = TRUE)

sim_blocksR(
  X,
  metric,
  row_blocks = 1,
  thresh = 0,
  n_cpu = 1,
  cl = NA,
  include_diag = TRUE
)

Arguments

X

A matrix, or an object that can be coerced into a matrix. Values depend on the type of metric used (numeric, 1/0 integers, etc.)

metric

One of the supported metrics. Currently hamming or cosine. For loop based functions you can also specify a function that takes two rows from the raw X and returns a distance

thresh

Float. Minimal similarity threshold to be returned. Values below are converted to 0 (to allow sparse representation). Default is 0.0

n_cpu

Integer. Number of cores to use for the local cluster (using the doParallel and parallel backend). Default is 1 which results in a simple R loop. Negative numbers are interpreted as "all CPU expect".

cl

A cluster object, pointing to the cluster to be used instead of a local cluster. This option overrides the n_cpu parameter.

include_diag

Logical. Should the diagonal of 1 be included in the matrix? This can help save memory. Default is TRUE.

row_blocks

Integer. How to divide matrix rows into blocks for block-wise similarity calculation (using matrix multiplication). Default is 1 which means similarity is calculated in a single step.

col_block

Integer. Not implemented yet

Value

An object of symmetricMatrix class. Default is a sparse matrix but this can be modified using the sparse parameter

Functions


ytoren/simscaleR documentation built on April 17, 2021, 12:32 p.m.