This function constructs and uses a neural network to denoise expression levels spatially.

runAutoencoderDenoising(
  object,
  activation,
  bottleneck,
  mtr_name_output = "denoised",
  layers = c(128, 64, 32),
  dropout = 0.1,
  epochs = 20,
  display_plot = FALSE,
  genes,
  set_as_active = FALSE,
  verbose = TRUE,
  of_sample = NA
)

Arguments

object

A valid spata-object.

activation

Character value. Denotes the activation function. (defaults to 'relu')

bottleneck

Numeric value. Denotes the number of bottleneck neurons.

mtr_name_output

Character value. Denotes the name under which the denoised matrix is stored in the data slot.

layers

Numeric vector of length 3. Denotes the number of neurons in the three hidden layers. (default = c(128, 64, 32))

dropout

Numeric value. Denotes the dropout. (defaults to 0.1)

epochs

Numeric value. Denotes the epochs of the neural network. (defaults to 20)

display_plot

Logical. If set to TRUE a scatter plot of the result is displayed in the viewer pane. See documentation for plotAutoencoderResults() for more information.

genes

Character vector of length two. Denotes the genes to be used for the validation plot.

set_as_active

Logical. If set to TRUE the denoised matrix is set as the active matrix via setActiveExpressionMatrix().

Value

A spata-object containing the denoised expression matrix in slot @data$denoised. This matrix is then denoted as the active matrix.