prepare_mofa: Prepare a MOFA for training

View source: R/prepare_mofa.R

prepare_mofaR Documentation

Prepare a MOFA for training

Description

Function to prepare a MOFA object for training. It requires defining data, model and training options.

Usage

prepare_mofa(
  object,
  data_options = NULL,
  model_options = NULL,
  training_options = NULL,
  stochastic_options = NULL,
  mefisto_options = NULL
)

Arguments

object

an untrained MOFA

data_options

list of data_options (see get_default_data_options details). If NULL, default options are used.

model_options

list of model options (see get_default_model_options for details). If NULL, default options are used.

training_options

list of training options (see get_default_training_options for details). If NULL, default options are used.

stochastic_options

list of options for stochastic variational inference (see get_default_stochastic_options for details). If NULL, default options are used.

mefisto_options

list of options for mefisto (see get_default_mefisto_options for details). If NULL, default options are used.

Details

This function is called after creating a MOFA object (using create_mofa) and before starting the training (using run_mofa). Here, we can specify different options for the data (data_options), the model (model_options) and the trainig (training_options, stochastic_options). Take a look at the individual default options for an overview using the get_default_XXX_options functions above.

Value

Returns an untrained MOFA with specified options filled in the corresponding slots

Examples

# Using an existing simulated data with two groups and two views
file <- system.file("extdata", "test_data.RData", package = "MOFA2")

# Load data dt (in data.frame format)
load(file) 

# Create the MOFA object
MOFAmodel <- create_mofa(dt)

# Prepare MOFA object using default options
MOFAmodel <- prepare_mofa(MOFAmodel)

# Prepare MOFA object changing some of the default model options values
model_opts <- get_default_model_options(MOFAmodel)
model_opts$num_factors <- 10
MOFAmodel <- prepare_mofa(MOFAmodel, model_options = model_opts)

bioFAM/MOFA2 documentation built on June 12, 2024, 3:57 p.m.