I have the following lists Y and EY with actual and estimated outcomes.
Y = {-1., -1., 1., -1., -1., -1., 1., 1., -1., -1., -1., -1., -1., -1., \
-1., -1., -1., -1., -1., -1., 1., 1., -1., -1., -1., -1., 1., -1., \
1., -1., -1., -1., -1., -1., -1., -1., 1., -1., -1., -1., -1., -1., \
-1., -1., -1., -1., 1., -1., -1., 1., 1., -1., 1., 1., 1., -1., 1., \
-1., 1., -1., -1., -1., -1., 1., -1., 1., -1., -1., -1., 1., -1., \
-1., -1., 1., 1., 1., 1., 1., -1., 1., -1., 1., -1., -1., 1., 1., \
-1., -1., 1., 1., -1., -1., 1., 1., 1., -1., -1., -1., 1., -1., 1., \
-1., -1., 1., 1., 1., -1., -1., -1., -1., -1., -1., -1., -1., -1., \
-1., -1., 1., -1., 1., 1., -1., 1., -1., 1., -1., -1., 1., -1., -1., \
-1., -1., -1., -1., -1., -1., -1.}
EY = {-1., -1., -1., -1., -1., -1., 1., 1., -1., -1., -1., -1., -1., -1.,
-1., -1., -1., -1., -1., 1., 1., 1., -1., -1., -1., -1., 1., -1., 1.,
-1., -1., -1., -1., -1., 1., 1., 1., -1., -1., -1., -1., 1., -1., 1.,
-1., 1., -1., 1., -1., -1., 1., -1., 1., 1., 1., -1., 1., -1., 1.,
1., -1., -1., -1., 1., 1., 1., 1., -1., -1., -1., -1., -1., -1., 1.,
1., 1., 1., -1., -1., 1., -1., 1., 1., -1., 1., 1., -1., 1., 1., 1.,
-1., -1., 1., 1., 1., -1., -1., 1., 1., -1., 1., -1., -1., 1., 1.,
-1., -1., -1., 1., -1., -1., 1., 1., 1., -1., -1., -1., 1., -1., 1.,
1., -1., 1., -1., 1., -1., -1., 1., -1., -1., -1., -1., -1., -1., 1.,
1., -1.}
I want to calculate the recall metric. To do so I intuitively try this (for the shake of simplicity it is not the actual recall formula, just its numerator to make the question easier to follow):
recall = (Count[Y == 1.0 && EY == 1.0, True])
0
But when I do this, I can get the actual count:
Count[Thread[Thread[Y == 1.0] && Thread[EY == 1.0]], True]
38
Why the first expression is not applying == to each element?
==is the short form forEqual.Equaldoes not have the attributeListableas seen fromAttributes[Equal]. To see what the attribute listable means compare the outputs from the following two examples: – userrandrand Dec 27 '22 at 20:54Array[a, 4]~Function[{a, b}, a == b]~Array[b, 4]– userrandrand Dec 27 '22 at 20:54Array[a, 4]~Function[{a, b}, a == b, Listable]~Array[b, 4]– userrandrand Dec 27 '22 at 20:54