prepare_mofa: Prepare a MOFA for training

Description Usage Arguments Details Value Examples

View source: R/prepare_mofa.R

Description

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

Usage

1
2
3
4
5
6
7
prepare_mofa(
  object,
  data_options = NULL,
  model_options = NULL,
  training_options = NULL,
  stochastic_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.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# 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)

MOFA2 documentation built on Nov. 8, 2020, 7:28 p.m.