multiview_pca: Multiview PCA

View source: R/multiscaleSVDxpts.R

multiview_pcaR Documentation

Multiview PCA

Description

Perform Multiview PCA on multiple datasets with an option for sparse PCA.

Usage

multiview_pca(
  views,
  n_components,
  sparse = 0.5,
  max_iter = 100,
  sparsenessAlg = "basic",
  verbose = FALSE
)

Arguments

views

A list of data matrices for each view.

n_components

Number of principal components to compute.

sparse

vector of length views with values between zero and one

max_iter

Maximum number of iterations for the optimization.

sparsenessAlg

NA is default otherwise basic, spmp or orthorank

verbose

Logical, whether to print information about energy and sparsity.

Value

A list containing the common representation Z and transformation matrices W.

Examples

set.seed(123)
n_samples <- 100
n_features_1 <- 50
n_features_2 <- 60
n_features_3 <- 70
n_components <- 5
view1 <- matrix(rnorm(n_samples * n_features_1), nrow = n_samples, ncol = n_features_1)
view2 <- matrix(rnorm(n_samples * n_features_2), nrow = n_samples, ncol = n_features_2)
view3 <- matrix(rnorm(n_samples * n_features_3), nrow = n_samples, ncol = n_features_3)
result <- multiview_pca(list(view1, view2, view3), n_components, sparse = rep(0.5,3), 
 verbose = TRUE)
print(result)

stnava/ANTsR documentation built on April 13, 2025, 4:10 a.m.