Skip to content

bingx1990/LOVE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LOVE

LOVE performs overlapping clustering of feature variables under a structured latent factor model.

Installation

You can install the development version from GitHub with:

install.packages("devtools")
devtools::install_github("bingx1990/LOVE")

Example

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 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))

Practical pre-screening

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")
#> Features with indices in 7 are detected as pure noise.
feature_ind <- setdiff(1:aug_p, noise_ind)

res_LOVE <- LOVE(X[,feature_ind,drop = F], pure_homo = FALSE)

About

Latent model based overlapping clustering

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages