I want to build a neural network classifier for binary class.
trainset.shape = (41712, 231)
testset.shape = (10429, 231)
It outputs:
ValueError                                Traceback (most recent call last)
 in ()
10     running_loss = 0
11
—> 12     for inputs, labels in trainloader:
13         optimizer.zero_grad()
14         log_ps = model(inputs)
ValueError: too many values to unpack (expected 2)
This is the code:
transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
trainloader = torch.utils.data.DataLoader(trainset, batch_size=1000, shuffle=True)
testloader = torch.utils.data.DataLoader(testset, batch_size=1000, shuffle=True)

class Classifier(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc1 = nn.Linear(230, 200)
        self.fc2 = nn.Linear(200, 150)
        self.fc3 = nn.Linear(150, 100)
        self.fc4 = nn.Linear(100, 1)        
    def forward(self, x):
        x = F.relu(self.fc1(x))
        x = F.relu(self.fc2(x))
        x = F.relu(self.fc3(x))
        x = F.log_sigmoid(self.fc4(x), dim=1)
        return x

model = Classifier()
criterion = nn.BCELoss()
optimizer = optim.Adam(model.parameters(), lr=0.003)
train_losses, test_losses = [], []
for e in range(30):
    running_loss = 0
    for inputs, labels in trainloader:
        optimizer.zero_grad()
        log_ps = model(inputs)
        loss = criterion(log_ps, labels)
        loss.backward()
        optimizer.step()
        running_loss += loss.item()

What is the problem here ?