Skip to content

Commit

Permalink
gitignore, model changes, epoch number changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mzaninovic555 committed May 7, 2024
1 parent 47ccc6b commit cd5cbed
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

models/**
runs/**
model/**

.idea/**

Expand Down
10 changes: 2 additions & 8 deletions model/football_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ def __init__(self, csv_file):
"competition_type"],
inplace=True)
self.data.dropna(inplace=True)
# self.data.fillna(0, inplace=True)

# transform all except result columns
x_scaled = preprocessing.MinMaxScaler().fit_transform(self.data)

# concat scaled and result columns
self.data = pd.DataFrame(x_scaled)

def __len__(self):
return len(self.data)
Expand All @@ -36,4 +29,5 @@ def __getitem__(self, idx):
features = sample[:-3].values.astype(dtype=float)
target = sample[-3:].values.astype(dtype=float)

return torch.tensor(features, dtype=torch.float32), torch.tensor(target, dtype=torch.float32)
return (torch.tensor(features, dtype=torch.float32),
torch.tensor(target, dtype=torch.float32))
11 changes: 4 additions & 7 deletions model/neural_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

input_features = 20
output_features = 3
dropout_rate = 0.5
hidden_layer_size = floor(input_features * 16)
hidden_layer_size2 = floor(input_features * 8)
hidden_layer_size3 = floor(input_features * 4)
dropout_rate = 0.2
hidden_layer_size = floor(input_features * 2)
hidden_layer_size2 = floor(input_features * 2)
hidden_layer_size3 = floor(input_features * 2)
hidden_layer_size4 = floor(input_features * 2)


Expand All @@ -26,19 +26,16 @@ def __init__(self):

# hidden 1
nn.Linear(hidden_layer_size, hidden_layer_size2),
nn.BatchNorm1d(hidden_layer_size2),
self.activation_function,
self.dropout,

# hidden 2
nn.Linear(hidden_layer_size2, hidden_layer_size3),
nn.BatchNorm1d(hidden_layer_size3),
self.activation_function,
self.dropout,

# hidden 3
nn.Linear(hidden_layer_size3, hidden_layer_size4),
nn.BatchNorm1d(hidden_layer_size4),
self.activation_function,

# output
Expand Down
4 changes: 2 additions & 2 deletions model/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
dataset = FootballDataset('./data/dataset.csv')

batch_size = 64
epochs = 80
epochs = 30
learning_rate = 0.003

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
Expand Down Expand Up @@ -85,7 +85,7 @@
now = datetime.datetime.now().strftime('%Y_%m_%d_%H_%M_%S')

model_scripted = torch.jit.script(model)
model_scripted.save(f'./models/football_predictor_{now}_dict.pt')
model_scripted.save(f'./models/football_predictor_{now}.pt')

# torch.save(model.state_dict(), f'./models/football_predictor_{now}_dict.pt')
# torch.save(model, f'./models/football_predictor_{now}_model.pt')
Expand Down

0 comments on commit cd5cbed

Please sign in to comment.