B0b3rt1's picture
Upload model.py with huggingface_hub
83e117f verified
import torch
import torch.nn as nn
class DeepMLP(nn.Module):
"""Model 3: Głęboka sieć z progresywnym Dropout i L2"""
def __init__(self):
super(DeepMLP, self).__init__()
self.fc1 = nn.Linear(5000, 1024)
self.bn1 = nn.BatchNorm1d(1024)
self.dropout1 = nn.Dropout(0.5)
self.fc2 = nn.Linear(1024, 512)
self.bn2 = nn.BatchNorm1d(512)
self.dropout2 = nn.Dropout(0.4)
self.fc3 = nn.Linear(512, 256)
self.bn3 = nn.BatchNorm1d(256)
self.dropout3 = nn.Dropout(0.3)
self.fc4 = nn.Linear(256, 128)
self.bn4 = nn.BatchNorm1d(128)
self.dropout4 = nn.Dropout(0.2)
self.fc5 = nn.Linear(128, 6)
self.relu = nn.ReLU()
def forward(self, x):
x = self.relu(self.bn1(self.fc1(x)))
x = self.dropout1(x)
x = self.relu(self.bn2(self.fc2(x)))
x = self.dropout2(x)
x = self.relu(self.bn3(self.fc3(x)))
x = self.dropout3(x)
x = self.relu(self.bn4(self.fc4(x)))
x = self.dropout4(x)
x = self.fc5(x)
return x