I want to develop a neural network with 26 input features and 20 target variables. I used pytorch to construct the network. Now, I want the model to also include any possible relation between the target variables. This is how I constructed the network:
class NN(nn.Module):
def __init__(self):
super(NN, self).__init__()
self.fc1 = nn.Linear(n_features, 86) # Input layer to hidden layer
self.norm1 = nn.BatchNorm1d(86)
self.fc2 = nn.Linear(86, 32) # Hidden layer to hidden layer
self.norm2 = nn.BatchNorm1d(32)
self.fc3 = nn.Linear(32, 32) # Hidden layer to hidden layer
self.norm3 = nn.BatchNorm1d(32)
self.fc4 = nn.Linear(32, output_size)
self.cross_layer = nn.Linear(output_size, output_size) # detecting the possible relation between the target variables
def forward(self, x):
x = torch.relu(self.fc1(x))
x = self.norm1(x)
x = torch.relu(self.fc2(x))
x = self.norm2(x)
x = torch.relu(self.fc3(x))
x = self.norm3(x)
x = self.fc4(x)
x = self.cross_layer(x)
return x
In the model I have a cross_layer
layer but it is not making any difference in the prediction. Then, how can I properly construct a neural network that can leverage any possible relation between target variables?
I do appreciate any help.
Cheers