Skip to contents

Default parameters for Harmony batch correction

Usage

params_sc_harmony(
  k = NULL,
  sigma = 0.1,
  theta = 2,
  lambda = 1,
  block_size = 0.2,
  max_iter_kmeans = 20L,
  max_iter_harmony = 10L,
  epsilon_kmeans = 1e-05,
  epsilon_harmony = 1e-04,
  window_size = 2L,
  kmeans = list()
)

Arguments

k

Integer or NULL. Number of clusters for k-means clustering. If not provided, it will be automatically determined as min(round(N / 30), 100). Defaults to NULL.

sigma

Numeric vector. Per-cluster diversity weights. Either a single value (broadcast to all clusters) or a vector of length k. Defaults to 0.1.

theta

Numeric vector. Per-variable diversity penalties. Either a single value (broadcast to all variables) or a vector of length equal to the number of batch variables. Defaults to 2.0.

lambda

Numeric vector. Ridge regression penalty for the linear model. Typically a single value that is broadcast to all design matrix columns. Defaults to 1.0.

block_size

Numeric. Fraction of cells to update per block during optimisation (0.0-1.0). Lower values reduce memory usage but increase computation time. Defaults to 0.2.

max_iter_kmeans

Integer. Maximum number of k-means iterations per Harmony round. Defaults to 20L.

max_iter_harmony

Integer. Maximum number of Harmony outer iterations. Defaults to 10L.

epsilon_kmeans

Numeric. Convergence threshold for k-means clustering. Stops when the relative change in cluster assignments falls below this value. Defaults to 1e-05.

epsilon_harmony

Numeric. Convergence threshold for Harmony. Stops when the relative change in the objective function falls below this value. Defaults to 1e-04.

window_size

Integer. Number of previous iterations to consider when checking convergence. Defaults to 2L.

kmeans

List. Optional overrides for the k-means clustering algorithm Possible parameters are "k_means_iter", "k_means_init", "gemm" and "hamerly", see params_kmeans_defaults(). See params_kmeans_defaults() for the available elements. Defaults to list().

Value

A named list with the following elements:

  • k - Integer or NULL. Number of clusters for k-means clustering. If not provided, it will be automatically determined as min(round(N / 30), 100). Defaults to NULL.

  • sigma - Numeric vector. Per-cluster diversity weights. Either a single value (broadcast to all clusters) or a vector of length k. Defaults to 0.1.

  • theta - Numeric vector. Per-variable diversity penalties. Either a single value (broadcast to all variables) or a vector of length equal to the number of batch variables. Defaults to 2.0.

  • lambda - Numeric vector. Ridge regression penalty for the linear model. Typically a single value that is broadcast to all design matrix columns. Defaults to 1.0.

  • block_size - Numeric. Fraction of cells to update per block during optimisation (0.0-1.0). Lower values reduce memory usage but increase computation time. Defaults to 0.2.

  • max_iter_kmeans - Integer. Maximum number of k-means iterations per Harmony round. Defaults to 20L.

  • max_iter_harmony - Integer. Maximum number of Harmony outer iterations. Defaults to 10L.

  • epsilon_kmeans - Numeric. Convergence threshold for k-means clustering. Stops when the relative change in cluster assignments falls below this value. Defaults to 1e-05.

  • epsilon_harmony - Numeric. Convergence threshold for Harmony. Stops when the relative change in the objective function falls below this value. Defaults to 1e-04.

  • window_size - Integer. Number of previous iterations to consider when checking convergence. Defaults to 2L.

  • The elements of params_kmeans_defaults(), overridden by kmeans, spliced in at this position.