Quantcast
Channel: Can I use == to compare two list element wise? - Mathematica Stack Exchange
Viewing all articles
Browse latest Browse all 8

Can I use == to compare two list element wise?

$
0
0

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?


Viewing all articles
Browse latest Browse all 8

Latest Images

Trending Articles





Latest Images