Two classifiers were scored on the same labelled test set and one has the higher accuracy. Decide whether the difference is more than chance, using McNemar's test on the examples where the two models disagree about correctness.
Implement mcnemar_test(y_true, pred_a, pred_b), where all three are equal-length sequences of labels (any hashable values, compared with ==). Return a dict:
table: the 2x2 list [[n11, n10], [n01, n00]], where n11 counts examples both models got right, n10 those only model A got right, n01 those only model B got right, and n00 those both got wrong.b, c: the discordant counts, b = n10 and c = n01, as ints.chi2: the continuity-corrected statistic
chi2_p: its p-value, the upper tail of a distribution at chi2.exact_p: the exact two-sided binomial p-value. With and ,
chi2 = 0.0, chi2_p = 1.0 and exact_p = 1.0.