I'm trying to run the following piece of code:
TN = np.sum((1 - predict) * (1 - actual))
where I have predicted, the variable that I cannot modify, which gets printed as follow:
[False False False False False False]
without any comma, so I guess it is not a list. Then, I have actual which is formatted as:
[False, False, False, False, False, False]
They have the same length, but when I run the command above I get the error:
TypeError: unsupported operand type(s) for -: 'int' and 'list'
How can I convert the variable actual so it can be compared to predicted?
CodePudding user response:
[False False False False False False]
is a numpy array:
l = [False, False, False, False, False, False]
a = np.array(l)
print(a)
# Output
[False False False False False False]
I think you have to convert actual
to numpy array.