knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
LOVE performs overlapping clustering of feature variables under a structured latent factor model.
You can install the development version from GitHub with:
install.packages("devtools") devtools::install_github("bingx1990/LOVE")
This is a basic example which shows you how to use the main function of LOVE. We start by generating a synthetic data set.
p <- 6 n <- 50 K <- 2 A <- rbind(c(1, 0), c(-1, 0), c(0, 1), c(0, 1), c(1/3, 2/3), c(1/2, -1/2)) Z <- matrix(rnorm(n * K, sd = 2), n, K) E <- matrix(rnorm(n * p), n, p) X <- Z %*% t(A) + E
The following code calls the LOVE function to perform overlapping clustering of the columns of the ${\mathbf X}$ matrix.
library(LOVE) res_LOVE <- LOVE(X, pure_homo = FALSE) res_LOVE <- LOVE(X, pure_homo = TRUE, delta = seq(0.1, 1.1 ,0.1))
In practice, we recommend a pre-screening procedure before calling the LOVE function. The function Screen_X detects the features that are close to pure noise. The following example demonstrates the usage of Screen_X.
aug_A <- rbind(A, c(0, 0)) aug_p <- nrow(aug_A) E <- matrix(rnorm(n * aug_p), n, aug_p) X <- Z %*% t(aug_A) + E noise_ind <- Screen_X(X)$noise_ind cat("Features with indices in", noise_ind, "are detected as pure noise.\n") feature_ind <- setdiff(1:aug_p, noise_ind) res_LOVE <- LOVE(X[,feature_ind,drop = F], pure_homo = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.