urbanlc.analyze.metrics.cohen_kappa#

urbanlc.analyze.metrics.cohen_kappa(m: ndarray) float#

Calculate Cohen’s Kappa coefficient from a confusion matrix.

Parameters:

m (np.ndarray) – Confusion matrix.

Returns:

Cohen’s Kappa coefficient, a measure of agreement between observers, adjusted for chance.

Return type:

float

The function computes row and column totals, as well as the observed and expected probabilities. Finally, Cohen’s Kappa coefficient is calculated and returned.