Skip to contents

Calculate the bisilhouette score.

Usage

bisilhouette(
  data,
  row_clustering,
  col_clustering,
  method = "euclidean",
  seed = TRUE,
  n_reps = 10
)

Arguments

data

data matrix, shape (N, p).

row_clustering

binary matrix indicating row clustering, shape(N, k).

col_clustering

binary matrix indicating column clustering, shape(p, k).

method

distance metric to use, str. Default is "euclidean".

seed

seed if seed should be set for random number generation, int. Default is FALSE.

n_reps

number of repetitions if random biclusters added, int. Default is 10.

Value

list containing; - bisil: bisilhouette score, float. - vals: individual sample scores, shape (N, ).

Examples

data <- matrix(stats::rnorm(50), nrow = 10)
row_clustering <- cbind(
  stats::rbinom(10, 1, 0.5),
  stats::rbinom(10, 1, 0.5),
  stats::rbinom(10, 1, 0.5)
)
col_clustering <- cbind(
  stats::rbinom(5, 1, 0.5),
  stats::rbinom(5, 1, 0.5),
  stats::rbinom(5, 1, 0.5)
)
bisilhouette(data, row_clustering, col_clustering)
#> $bisil
#> [1] -0.1499112
#> 
#> $vals
#> $vals[[1]]
#>           2           4           5           7          10 
#>  0.07897180  0.01118652 -0.10276959 -0.19003057  0.08365112 
#> 
#> $vals[[2]]
#>           3           4           5           6           7 
#> -0.18493879 -0.30868811 -0.23636111  0.04152502 -0.10797911 
#> 
#> $vals[[3]]
#>           1           2           3           5           7           8 
#> -0.08383198 -0.43240426 -0.12676552 -0.41951917 -0.18454112 -0.18374371 
#>          10 
#> -0.43572307 
#> 
#>