consensus_score

Function consensus_score 

Source
pub fn consensus_score<S, D>(alllabels: &[&ArrayBase<S, D>]) -> Result<f64>
where S: Data<Elem = usize>, D: Dimension,
Expand description

Calculate Consensus Score for multiple clusterings

Measures the agreement among multiple clusterings of the same dataset. Higher values indicate stronger consensus.

§Arguments

  • alllabels - Vector of arrays, each containing a clustering result

§Returns

  • Consensus score (between 0 and 1)

§Examples

use scirs2_core::ndarray::array;
use scirs2_metrics::clustering::validation::consensus_score;

let clustering1 = array![0, 0, 0, 1, 1, 1];
let clustering2 = array![1, 1, 1, 0, 0, 0];  // Same as clustering1 but with inverted labels
let clustering3 = array![0, 0, 1, 1, 2, 2];  // Different clustering

let all_clusterings = vec![&clustering1, &clustering2, &clustering3];
let score = consensus_score(&all_clusterings).unwrap();