C3 Week3 Assignment Exercise 4

Not able to solve the accuracy, How to get the output from preds using argmax ?
Although getting required shape but accuracy is not correct ? couldn’t figure out this. Require assistance in this code snippet.
outputs = np.argmax(pred,axis=-1)
print(“outputs shape:”, outputs.shape)
mask = labels != pad
print(“mask shape:”, mask.shape, “mask[0][20:30]:”, mask[0][20:30])
accuracy = np.sum(outputs * mask ==labels * mask)/np.sum(mask)

@balaji.ambresh Can you please help in here ?

Hi @Saikrishna508

You do not need to multiply by mask when calculating accuracy

1 Like

@arvyzukai Yes, that was stupid mistake! :sweat_smile: Thank you !