Open ftnext opened 1 year ago
https://rasbt.github.io/mlxtend/user_guide/evaluate/mcnemar_table/#example-2-2x2-contingency-table
The value of tb is not reproduced.
tb
array([[4, 1], [2, 3]])
This is the same code as the example of documentation
>>> import numpy as np >>> from mlxtend.evaluate import mcnemar_table >>> y_true = np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1]) >>> y_mod1 = np.array([0, 1, 0, 0, 0, 1, 1, 0, 0, 0]) # R, W, R, R, R, R, R, W, W, W >>> y_mod2 = np.array([0, 0, 1, 1, 0, 1, 1, 0, 0, 0]) # R, R, W, W, R, R, R, W, W, W >>> tb = mcnemar_table(y_target=y_true, y_model1=y_mod1, y_model2=y_mod2) >>> tb array([[4, 2], [1, 3]])
(In comment, R stands for right, W stands for wrong.)
Environment:
mlxtend 0.21.0 numpy 1.23.3
I think the value of tb in the current documentation seems to be wrong.
Reasons:
b: tb[0, 1]: # of samples that model 1 got right and model 2 got wrong
tb[0, 1] should be 2 (indices: 2, 3)
tb[0, 1]
c: tb[1, 0]: # of samples that model 2 got right and model 1 got wrong
tb[1, 0] should be 1 (indices: 1)
tb[1, 0]
From https://github.com/rasbt/mlxtend/blob/v0.21.0/mlxtend/evaluate/tests/test_mcnemar_table.py#L70-L77 , tb should be np.array([[4, 2], [1, 3]])
np.array([[4, 2], [1, 3]])
Change to
array([[4, 2], [1, 3]])
The checkerboard plot needs to be changed too.
Describe the documentation issue
https://rasbt.github.io/mlxtend/user_guide/evaluate/mcnemar_table/#example-2-2x2-contingency-table
The value of
tb
is not reproduced.This is the same code as the example of documentation
(In comment, R stands for right, W stands for wrong.)
Environment:
I think the value of
tb
in the current documentation seems to be wrong.Reasons:
tb[0, 1]
should be 2 (indices: 2, 3)tb[1, 0]
should be 1 (indices: 1)From https://github.com/rasbt/mlxtend/blob/v0.21.0/mlxtend/evaluate/tests/test_mcnemar_table.py#L70-L77 ,
tb
should benp.array([[4, 2], [1, 3]])
Suggest a potential improvement or addition
Change to
The checkerboard plot needs to be changed too.
Scope of impact
tb