Last active
April 6, 2021 19:44
-
-
Save bkaankuguoglu/836764857b7eec5ef7a0e4e51a5c33f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch.optim as optim | |
input_dim = len(X_train.columns) | |
output_dim = 1 | |
hidden_dim = 64 | |
layer_dim = 3 | |
batch_size = 64 | |
dropout = 0.2 | |
n_epochs = 100 | |
learning_rate = 1e-3 | |
weight_decay = 1e-6 | |
model_params = {'input_dim': input_dim, | |
'hidden_dim' : hidden_dim, | |
'layer_dim' : layer_dim, | |
'output_dim' : output_dim, | |
'dropout_prob' : dropout} | |
model = get_model('lstm', model_params) | |
loss_fn = nn.MSELoss(reduction="mean") | |
optimizer = optim.Adam(model.parameters(), lr=learning_rate, weight_decay=weight_decay) | |
opt = Optimization(model=model, loss_fn=loss_fn, optimizer=optimizer) | |
opt.train(train_loader, val_loader, batch_size=batch_size, n_epochs=n_epochs, n_features=input_dim) | |
opt.plot_losses() | |
predictions, values = opt.evaluate(test_loader_one, batch_size=1, n_features=input_dim) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment