Hi all, I am close to figuring this out but not quite. I’m trying to grade the accuracy of predictions from a predicted dataframe, and so I gather the predictions into a DataFrame like so:
predictions = learn.get_preds(DatasetType.Test)[1].numpy()
preds = pd.DataFrame(predictions)
The result of this is a location of the proper label from learn.data.classes, so I saved that array as arr. Let truth
be the test dataframe:
i = 0
predictions = learn.get_preds(DatasetType.Test)[1].numpy()
preds = pd.DataFrame(predictions)
arr = learn.data.classes
for x in range(len(preds)):
if(arr[int(preds.iloc[x])] == truth.iloc[x]):
i+=1
print(i/len(truth))
This should be working for generating an overall accuracy, but it reports back 44%. When I verify what the accuracy should be via learn.predict() over the entire dataframe I report an accuracy of 94.3%. Did I do something wrong with the above?
Thank you very much for your help!
Zach