sim_auto_scale: Choose a similarity calculation method based on simple...

Description Usage Arguments Value Examples

View source: R/automatic_resource_detection.R

Description

Estimate number of CPU and memory size for the current system and use these numbers to choose the appropriate calculation method (loops / matrix multiplication, see sim_loopR)

Usage

1
2
3
4
5
6
7
8
sim_auto_scale(
  n_rows,
  resources = NA,
  row2mem_coeff = 7.62940039228619e-06,
  row_cap = NA,
  verbose = FALSE,
  ...
)

Arguments

n_rows

Integer. The expected number of rows in the matrix for which we are calculating row similarity. n_rows^2 will be used as the potential number of cells generated by the similarity matrix.

resources

An optional list with n_cpu and block_memory. Default is NA which calls estimate_local_resources

row2mem_coeff

Float. The coefficient that converts between nrows^2 and object memory size in Mb. See vignette('estimating-local-resources.Rmd', package = 'simscaleR').

row_cap

Integer. Maximum number of rows for this machine. See vignette('estimating-local-resources.Rmd', package = 'simscaleR'). Default is NA which means no limit is applied

verbose

Logical. Should informative messages be printed along the way?

...

Additional parameters passed to estimate_local_resources (when resources = NA)

Value

A function to calculate similarity with n_cpu set according to the recommendations. You need to provide X, metric and thresh if needed (defaults to 0). For more details see sim_loopR)

Examples

1
## Not run: sim_matrix <- auto_sim_scale(nrow(X))(X, 'cosine', thresh = 0.8)

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