Computing Kappa Index

Kappa index in a widely used statistic for evaluating the agreement of two clustering results.

You are now following this Submission

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 (2026). Computing Kappa Index (https://www.mathworks.com/matlabcentral/fileexchange/22645-computing-kappa-index), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0