Homework 01
约 16 个字 19 行代码
sample code¶

medium baseline¶
先记录下几个参数
路径
tr_path = 'covid.train.csv' # path to training data
tt_path = 'covid.test.csv' # path to testing data
超参
device = get_device() # get the current available device ('cpu' or 'cuda')
os.makedirs('models', exist_ok=True) # The trained model will be saved to ./models/
target_only = False # TODO: Using 40 states & 2 tested_positive features
config = {
'n_epochs': 3000, # maximum number of epochs
'batch_size': 270, # mini-batch size for dataloader
'optimizer': 'SGD', # optimization algorithm (optimizer in torch.optim)
'optim_hparas': { # hyper-parameters for the optimizer (depends on which optimizer you are using)
'lr': 0.001, # learning rate of SGD
'momentum': 0.9 # momentum for SGD
},
'early_stop': 200, # early stopping epochs (the number epochs since your model's last improvement)
'save_path': 'models/model.pth' # your model will be saved here
}
Created:
January 3, 2024
Last update: April 24, 2026
Last update: April 24, 2026
Discussion