Building a binary classifier in PyTorch
Recall that a small neural network with a single linear layer followed by a sigmoid function is a binary classifier. It acts just like a logistic regression.
Practice building this small network and interpreting the output of the classifier.
Latihan ini adalah bagian dari kursus
Introduction to Deep Learning with PyTorch
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
import torch
import torch.nn as nn
input_tensor = torch.Tensor([[3, 4, 6, 2, 3, 6, 8, 9]])
# Implement a small neural network for binary classification
model = nn.Sequential(
nn.____(____),
nn.____()
)
output = model(input_tensor)
print(output)