I am trying to find the indices of the misclassified samples using the following code. But I found that the append function does not actually append the index. Can anyone explain why is this happening?
for i in range(len(predictions)):
misclassified_indices = []
if y_test[i] != predictions[i]:
print(i)
misclassified_indices.append(i)
print(misclassified_indices)
19
357
1553 # All misclassified samples are printed correctly ...
[] # ... but it does not append to this list