public void WeightedConfusionMatrixConstructorTest()
{
// Sample data from Fleiss, Cohen and Everitt (1968), Large sample standard errors
// of kappa and weighted kappa. Psychological Bulletin, Vol. 72, No. 5, 323-327
double[,] matrix =
{
{ 0.53, 0.05, 0.02 },
{ 0.11, 0.14, 0.05 },
{ 0.01, 0.06, 0.03 },
};
double[,] weights =
{
{ 1.0000, 0.0000, 0.4444 },
{ 0.0000, 1.0000, 0.6667 },
{ 0.4444, 0.6667, 1.0000 },
};
WeightedConfusionMatrix target = new WeightedConfusionMatrix(matrix, weights, samples: 200);
Assert.AreEqual(0.787, target.WeightedOverallAgreement, 1e-3);
Assert.AreEqual(0.567, target.WeightedChanceAgreement, 1e-3);
Assert.AreEqual(0.508, target.WeightedKappa, 1e-3);
Assert.AreEqual(0.00324823, target.WeightedVariance, 1e-5);
Assert.AreEqual(0.004270, target.WeightedVarianceUnderNull, 1e-3);
}