Wiki: Lesson 3

Hi there. I’m trying to use the submission code posted at the beginning of the lesson, but ran into errors. I found suggestions on here: Lesson1.ipynb - Error - TypeError: torch.max received an invalid combination of arguments - got (numpy.ndarray, dim=int) but they have not helped im afraid.

When calling

accuracy_np(probs, y), metrics.log_loss(y, probs)

I receive

~/src/fastai/courses/dl1/AaronsWorkbook/fastai/metrics.py in accuracy_np(preds, targs)
     13 def accuracy_np(preds, targs):
     14     preds = np.argmax(preds, 1)
---> 15     return (preds==targs).mean()
     16 
     17 def accuracy_thresh(thresh):

AttributeError: 'bool' object has no attribute 'mean'

I’m passing it the np.mean results of learn.TTA

log_preds, y = learn.TTA()
probs = np.mean(np.exp(log_preds),0)
accuracy_np(probs, y), metrics.log_loss(y, probs)

Is there another function or something I should be using? I realize this is in the old fastai folder, given im using v2.