Learn R Programming

clevr (version 0.1.2)

contingency_table_clusters: Contingency Table for Clusterings

Description

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

Usage

contingency_table_clusters(true, pred)

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.

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.

See Also

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

Examples

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

Run the code above in your browser using DataLab