weighted_element_consistency: Weighted Element-Centric Consistency

View source: R/ECS.R

weighted_element_consistencyR Documentation

Weighted Element-Centric Consistency

Description

Calculate the weighted element-centric consistency of a set of clusterings. The weights are used to give more importance to some clusterings over others.

Usage

weighted_element_consistency(
  clustering_list,
  weights = NULL,
  calculate_sim_matrix = FALSE
)

Arguments

clustering_list

The list of clustering results, each of which is either:

  • A numeric/character/factor vector of cluster labels for each element.

  • A samples x clusters matrix/Matrix::Matrix of nonzero membership values.

  • An hclust object.

weights

A numeric vector of weights for each clustering in clustering_list. If NULL, then all weights will be equal to 1. Defaults to NULL.

calculate_sim_matrix

A logical value that indicates whether to calculate the similarity matrix or not along with the consistency score. Defaults to FALSE.

Value

A vector containing the weighted element-wise consistency. If calculate_sim_matrix is set to TRUE, the element similarity matrix will be returned as well.

Note

The weighted ECC will be calculated as \displaystyle \frac{\sum_{i} \sum_{j} w_i w_j ECS(i, j)}{\sum_{i} w_i}

Examples

# cluster across 20 random seeds
clustering_list <- lapply(1:20, function(x) kmeans(mtcars, centers = 3)$cluster)
weights <- sample(1:10, 20, replace = TRUE)
weighted_element_consistency(clustering_list, weights = weights)

Core-Bioinformatics/ClustAssess documentation built on Dec. 19, 2024, 8:19 p.m.