Homework 1: COVID-19 Cases Prediction (Regression)
Author: Heng-Jui Chang
- Solve a regression problem with deep neural networks (DNN).
- Understand basic DNN training tips.
- Get familiar with PyTorch.
If any questions, please contact the TAs via TA hours, NTU COOL, or email.
If the Google drive links are dead, you can download data from kaggle, and upload data manually to the workspace.
Import Some Packages
You do not need to modify this part.
We have three kinds of datasets:
train: for training
dev: for validation
test: for testing (w/o target value)
COVID19Dataset below does:
- extract features
covid.train.csvinto train/dev sets
- normalize features
TODO below might make you pass medium baseline.
DataLoader loads data from a given
Dataset into batches.
Deep Neural Network
NeuralNet is an
nn.Module designed for regression.
The DNN consists of 2 fully-connected layers with ReLU activation.
This module also included a function
cal_loss for calculating loss.
config contains hyper-parameters for training and the path to save your model.
Load data and model
The predictions of your model on testing set will be stored at
- Run sample code
- Feature selection: 40 states + 2
- Feature selection (what other features are useful?)
- DNN architecture (layers? dimension? activation function?)
- Training (mini-batch? optimizer? learning rate?)
- L2 regularization
- There are some mistakes in the sample code, can you find them?
This code is completely written by Heng-Jui Chang @ NTUEE.
Copying or reusing this code is required to specify the original author.
Source: Heng-Jui Chang @ NTUEE (https://github.com/ga642381/ML2021-Spring/blob/main/HW01/HW01.ipynb)