Computing Kappa Index

Kappa index in a widely used statistic for evaluating the agreement of two clustering results.
1.5K Downloads
Updated 11 Jan 2009

View License

USAGE kappa=kappaindex(X,G,N)

X is a vector of length M (number of data samples). Each entry of X is associated with the cluster index for that sample

G is a vector in the same format of X belonging to ground truth indecies or a secondary clustering

N is the number of clusters

This measure only works when X and G have the same number of clusters. In addition, the set of indecies must be integers from one through the number of clusters.

However, they might be equivalent through a permutation of indecies

Example:
>> X=[1 1 2 2 3 3]; G=[2 2 1 1 3 3]; kappaindex(X,G,3)
ans = 1
>> X=[1 1 2 2 4 4 3]; G=[4 2 2 2 1 1 3]; kappaindex(X,G,4)
ans = 0.8056

Cite As

Hossein Mobahi (2025). Computing Kappa Index (https://www.mathworks.com/matlabcentral/fileexchange/22645-computing-kappa-index), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2008b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Cluster Analysis and Anomaly Detection in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0