Description Usage Arguments Details Value Examples
Plot top weights for a given factor and view.
1 2 3 4 5 6 7 8 9 |
object |
a trained |
view |
a string with the view name, or an integer with the index of the view. |
factors |
a character string with factors names, or an integer vector with factors indices. |
nfeatures |
number of top features to display. Default is 10 |
abs |
logical indicating whether to use the absolute value of the weights (Default is FALSE). |
scale |
logical indicating whether to scale all weights from -1 to 1 (or from 0 to 1 if abs=TRUE). Default is TRUE. |
sign |
can be 'positive', 'negative' or 'all' to show only positive, negative or all weights, respectively. Default is 'all'. |
An important step to annotate factors is to visualise the corresponding feature weights.
This function displays the top features with highest loading whereas the function plot_top_weights
plots all weights for a given latent factor and view.
Importantly, the weights of the features within a view have relative values and they should not be interpreted in an absolute scale.
Therefore, for interpretability purposes we always recommend to scale the weights with scale=TRUE
.
Returns a ggplot2
object
1 2 3 4 5 6 7 8 9 | # Using an existing trained model on simulated data
file <- system.file("extdata", "model.hdf5", package = "MOFA2")
model <- load_model(file)
# Plot top weights for Factors 1 and 2 and View 1
plot_top_weights(model, view = 1, factors = c(1,2))
# Do not take absolute value
plot_weights(model, abs = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.