Hello,
I am making a neural network to make a binary classification and I would like to check the predictions made in the testing phase of my network, but I don’t seem to be getting the proper values.
What I want is not the loss over the whole batch but each prediction over every test sample to compare it to the true value.
My testing goes like this :
net.eval()    
for i_batch, sample_batched in enumerate(dataloader):
        data = Variable(sample_batched['tensor'].view(batch_size, -1, max_size * 20), requires_grad=False, volatile=True)
        if gpu_used >= 0:
            target = Variable(sample_batched['interaction'].cuda(gpu_used), requires_grad=False, volatile=True)
        else:
            target = Variable(sample_batched['interaction'], requires_grad=False, volatile=True)
        output = net(data)
        #test_loss += criterion(output, target).data[0]                                                                                                                                                             
        test_loss += F.nll_loss(output, target, size_average=False).data[0] #fsize_average=False to sum, instead of average losses                                                                                  
        pred = output.data.max(1, keepdim=True)[1]

        correct += pred.eq(target.data.view_as(pred)).cpu().sum() # to operate on variables they need to be on the CPU again

I would appreciate if anyone could give me some pointers to how I could proceed.