I have a two layer Neural Network. Given the weights and biases predicted by Neural Network, how to draw the decision boundary on this dataset?
My Neural network is defined as follows:
class Classifier(nn.Module):
def __init__(self):
super().__init__()
self.fc1 = nn.Linear(2,2)
self.fc2 = nn.Linear(2,1)
def forward(self,x):
x = F.relu(self.fc1(x))
x = self.fc2(x)
return x
list(model.parameters())
returns me
[Parameter containing:
tensor([[-0.5128, -0.3776],
[ 0.4611, 0.4625]], requires_grad=True), Parameter containing:
tensor([ 0.6443, -3.6282], requires_grad=True), Parameter containing:
tensor([[-0.1985, 2.8158]], requires_grad=True), Parameter containing:
tensor([-5.4537], requires_grad=True)]
The Google Colab notebook is attached. You will find the complete code under Toy Dataset 3 predicting logits. Besides, I have drawn 1 layer neural network decision boundary as an example. Find it under Toy Dataset 2 predicting logits. For your ease, 1 layer neural network dataset and its decision boundary is attached here as well.