Skip to content

dabbonda/CS230

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

101 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CS 230 Project

Quickstart (~10 min)

  1. Split the dataset Split the FETAL dataset into train/val/test sets.
python split_dataset.py
  1. Your first experiment We created a base_model directory for you under the experiments directory. It contains a file params.json which sets the hyperparameters for the experiment. It looks like
{
    "learning_rate": 1e-3,
    "batch_size": 32,
    "num_epochs": 10,
    ...
}

For every new experiment, you will need to create a new directory under experiments with a similar params.json file.

  1. Train your experiment. Simply run
python train.py --data_dir data/FETAL --model_dir experiments/base_model

It will instantiate a model and train it on the training set following the hyperparameters specified in params.json. It will also evaluate some metrics on the validation set.

  1. Your first hyperparameters search We created a new directory learning_rate in experiments for you. Now, run
python search_hyperparams.py --data_dir data/FETAL --parent_dir experiments/learning_rate

It will train and evaluate a model with different values of learning rate defined in search_hyperparams.py and create a new directory for each experiment under experiments/learning_rate/.

  1. Display the results of the hyperparameters search in a nice format
python synthesize_results.py --parent_dir experiments/learning_rate
  1. Evaluation on the test set Once you've run many experiments and selected your best model and hyperparameters based on the performance on the validation set, you can finally evaluate the performance of your model on the test set. Run
python evaluate.py --data_dir data/FETAL --model_dir experiments/base_model

Guidelines for more advanced use

We recommend reading through train.py to get a high-level overview of the training loop steps:

  • loading the hyperparameters for the experiment (the params.json)
  • loading the training and validation data
  • creating the model, loss_fn and metrics
  • training the model for a given number of epochs by calling train_and_evaluate(...)

You can then have a look at data_loader.py to understand:

  • how jpg images are loaded and transformed to torch Tensors
  • how the data_iterator creates a batch of data and labels and pads sentences

Once you get the high-level idea, depending on your dataset, you might want to modify

  • model/net.py to change the neural network, loss function and metrics
  • model/data_loader.py to suit the data loader to your specific needs
  • train.py for changing the optimizer
  • train.py and evaluate.py for some changes in the model or input require changes here

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors