contingency_table_clusters: Contingency Table for Clusterings

View source: R/measures_clusterings.R

contingency_table_clustersR Documentation

Contingency Table for Clusterings

Description

Compute the contingency table for a predicted clustering given a ground truth clustering.

Usage

contingency_table_clusters(true, pred)

Arguments

true

ground truth clustering represented as a membership vector. Each entry corresponds to an element and the value identifies the assigned cluster. The specific values of the cluster identifiers are arbitrary.

pred

predicted clustering represented as a membership vector.

Value

Returns a table C (stored as a sparse matrix) such that C_{ij} counts the number of elements assigned to cluster i in pred and cluster j in true.

See Also

eval_report_clusters computes common evaluation measures derived from the output of this function.

Examples

true <- c(1,1,1,2,2)  # ground truth clustering
pred <- c(1,1,2,2,2)  # predicted clustering
contingency_table_clusters(true, pred)


clevr documentation built on Sept. 16, 2023, 5:06 p.m.