Adding a new hidden layer

How can i add more hidden layer to this code, and i added more hidden layer should it increase the accurcy of the model, I’ve got 76%
and can i contact you in anthor place to review the code with me ?

this the code:

class Model(nn.Module):

    def __init__(self, embedding_size, num_numerical_cols, output_size, layers, p=0.4):
        self.all_embeddings = nn.ModuleList([nn.Embedding(ni, nf) for ni, nf in embedding_size])
        self.embedding_dropout = nn.Dropout(p)
        self.batch_norm_num = nn.BatchNorm1d(num_numerical_cols)

        all_layers = []
        num_categorical_cols = sum((nf for ni, nf in embedding_size))
        input_size = num_categorical_cols + num_numerical_cols

        for i in layers:
            all_layers.append(nn.Linear(input_size, i))
            input_size = i

        all_layers.append(nn.Linear(layers[-1], output_size))

        self.layers = nn.Sequential(*all_layers)

    def forward(self, x_categorical, x_numerical):
        embeddings = []
        for i,e in enumerate(self.all_embeddings):
        x =, 1)
        x = self.embedding_dropout(x)

        x_numerical = self.batch_norm_num(x_numerical)
        x =[x, x_numerical], 1)
        x = self.layers(x)
        return x

Adding more layers to your model doesn’t necessarily improve the accuracy so you would need to experiment with your model for your use case.

Based on your code it seems you could simply pass more feature sizes in layers to add more linear layers.