I am having issues comparing 2 numPy arrays against each other. I am currently doing a classification task and have classified data into either 1's or 0's. I want to compare the predictions against the actual label.
attached is an image of the two arrays. I cannot seem to find a way .
though not ideal, I have tried the following:
for i in range(len(yTrain)):
yTrain==yPred
I was hoping that it would return a bunch of true and false values which I could manually tally up but that didn't work.
I would like an output which counts the number of inaccuracies. e.g. out of 200 datapoints, 45 were misclassified or something along those lines
If you want the count of where yTrain == yPred
, you can use np.count_nonzero
:
matches = np.count_nonzero(yTrain == yPred)
mismatches = yTrain.size - matches