Tutorial 1 - Regularization Techniques Part 1 - Neuromatch Academy - Deep Learning
Tutorial 1 - Regularization Techniques Part 1 - Neuromatch Academy - Deep Learning
Tutorial 1 - Regularization Techniques Part 1 - Neuromatch Academy - Deep Learning
By Neuromatch Academy
Content creators: Ravi Teja Konkimalla, Mohitrajhu Lingan Kumaraian, Kevin Machado Gamboa, Kelson Shilling-Scrivo,
Lyle Ungar
1. Big Artificial Neural Networks (ANNs) are efficient universal approximators due to their adaptive basis functions
2. ANNs memorize some but generalize well
3. Regularization as shrinkage of overparameterized models: early stopping
https://deeplearning.neuromatch.io/tutorials/W2D1_Regularization/student/W2D1_Tutorial1.html 04/06/24, 3 01 PM
Page 1 of 34
:
Note that some of the code for today can take up to an hour to run. We have therefore “hidden” the code and shown
the resulting outputs.
Install dependencies
WARNING: There may be errors and/or warnings reported during the installation. However, they should be ignored.
# Imports
import time
import copy
import torch
import pathlib
import numpy as np
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import matplotlib.pyplot as plt
import matplotlib.animation as animation
Figure Settings
Show code cell source
https://deeplearning.neuromatch.io/tutorials/W2D1_Regularization/student/W2D1_Tutorial1.html 04/06/24, 3 01 PM
Page 2 of 34
:
Loading Animal Faces data
Show code cell source
Download completed.
Download completed.
Plotting functions
Show code cell source
SEED = 2021
set_seed(seed=SEED)
DEVICE = set_device()
Let’s start the tutorial by defining some functions which we will use frequently today, such as: AnimalNet , train ,
test and main .
https://deeplearning.neuromatch.io/tutorials/W2D1_Regularization/student/W2D1_Tutorial1.html 04/06/24, 3 01 PM
Page 3 of 34
: