View source: R/contribution_scores.R
calculate_contribution_scores | R Documentation |
This function calculates, *for each sample* how much each view contributes to its location in the latent manifold, what we call contribution scores
calculate_contribution_scores(
object,
views = "all",
groups = "all",
factors = "all",
scale = TRUE
)
object |
a trained |
views |
character vector with the view names, or numeric vector with view indexes. Default is 'all' |
groups |
character vector with the group names, or numeric vector with group indexes. Default is 'all' |
factors |
character vector with the factor names, or numeric vector with the factor indexes. Default is 'all' |
scale |
logical indicating whether to scale the sample-wise variance explained values by the total amount of variance explained per view.
This effectively normalises each view by its total variance explained. It is important when different amounts of variance is explained for each view (check with |
Contribution scores are calculated in three steps:
Step 1calculate variance explained for each cell i and each view m (R_{im}
), using all factors
Step 2(optional) scale values by the total variance explained for each view
Step 3calculate contribution score (C_{im}
) for cell i and view m as:
C_{im} = \frac{R2_{im}}{\sum_{m} R2_{im}}
Note that contribution scores can be calculated using any number of data modalities, but it is easier to interpret when you specify two.
Please note that this functionality is still experimental, contact the authors if you have questions.
adds the contribution scores to the metadata slot (samples_metadata(MOFAobject)
) and to the MOFAobject@cache
slot
# Using an existing trained model on simulated data
file <- system.file("extdata", "model.hdf5", package = "MOFA2")
model <- load_model(file)
model <- calculate_contribution_scores(model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.