1 of 32

Deep Learning (DEEP-0001)�

9 – Performance

2 of 32

Measuring performance

  • MNIST1D dataset model and performance
  • Noise, bias, and variance
  • Reducing variance
  • Reducing bias & bias-variance trade-off
  • Double descent
  • Curse of dimensionality & weird properties of high dimensional space
  • Choosing hyperparameters

​

3 of 32

MNIST Dataset

4 of 32

MNIST 1D Dataset

5 of 32

Network

  • 40 inputs
  • 10 outputs
  • 4000 training examples (~400 training examples per class)
  • Two hidden layers
    • 100 hidden units each
  • SGD with batch size 100, learning rate 0.1
  • 6000 steps (150 Epochs)

​

6 of 32

Need to use separate test data

The model has not generalized well to the new data

7 of 32

Measuring performance

  • MNIST1D dataset model and performance
  • Noise, bias, and variance
  • Reducing variance
  • Reducing bias & bias-variance trade-off
  • Double descent
  • Curse of dimensionality & weird properties of high dimensional space
  • Choosing hyperparameters

​

8 of 32

Regression example

Generated data: Sampling input values in the range [0, 1], passing them through this function, and adding Gaussian noise with a fixed variance.

9 of 32

Toy model

  • K hidden units
  • First layer fixed so “joints” divide the interval evenly
  • Second layer trained

10 of 32

Noise, bias, and variance

  • Noise in measurements
  • Some variables not observed
  • Data mislabeled

​

​

Data generation is noisy, so even if the model exactly replicates the true underlying function (black line), the noise in the test data (gray points) means that some error will remain (gray region represents two standard deviations).

11 of 32

Noise, bias, and variance

The three-region model (cyan line) cannot exactly fit the true function (black line).

12 of 32

Noise, bias, and variance

Depending on the training dataset, the results will vary slightly each time.

13 of 32

Noise, bias, and variance

  • Variance is the uncertainty in fitted model due to choice of training set
  • Bias is systematic deviation from the mean of the function we are modeling due to limitations in our model
  • Noise is inherent uncertainty in the true mapping from input to output

14 of 32

Measuring performance

  • MNIST1D dataset model and performance
  • Noise, bias, and variance
  • Reducing variance
  • Reducing bias & bias-variance trade-off
  • Double descent
  • Curse of dimensionality & weird properties of high dimensional space
  • Choosing hyperparameters

​

15 of 32

Variance

Can reduce variance by adding more samples

16 of 32

Measuring performance

  • MNIST1D dataset model and performance
  • Noise, bias, and variance
  • Reducing variance
  • Reducing bias & bias-variance trade-off
  • Double descent
  • Curse of dimensionality & weird properties of high dimensional space
  • Choosing hyperparameters

​

17 of 32

Reducing bias

Increasing model capacity also increases the variance term (gray region). This is known as the bias-variance trade-off.

18 of 32

Why does variance increase? Overfitting

Describes the training data better, but not the true underlying function (black curve)

model with three regions

model with ten regions

19 of 32

Bias and variance trade-off

model capacity (number of hidden units / linear regions in range of data)

20 of 32

Measuring performance

  • MNIST1D dataset model and performance
  • Noise, bias, and variance
  • Reducing variance
  • Reducing bias & bias-variance trade-off
  • Double descent
  • Curse of dimensionality & weird properties of high dimensional space
  • Choosing hyperparameters

​

21 of 32

Number of datapoints

MNIST-1D for a two-hidden layer network as we increase the number of hidden units

The training error decreases to zero as the number of parameters approaches the number of training examples (vertical dashed line).

​

The test error does not show the expected bias-variance trade-off but continues to decrease even after the model has memorized the dataset.

22 of 32

Double descent

noisier training data

  • The training error reduces to zero, although it now takes almost as many parameters as training points to memorize the dataset.

​

  • The test error shows the predicted bias/variance trade-off; it decreases as the capacity increases but then increases again as we near the point where the training data is exactly memorized.
    • However, it subsequently decreases again and ultimately reaches a better performance level. This is known as double descent.

23 of 32

24 of 32

  • Note that train data is very close to zero.
  • Whatever is happening isn’t happening at training data points
  • Must be happening between the data points??

​

25 of 32

Potential explanation:

    • can make smoother functions with more hidden units
    • being smooth between the datapoints is a reasonable thing to do

But why?

26 of 32

  • All of these solutions are equivalent in terms of loss.
  • Why should the model choose the smooth solution?
  • Tendency of model to choose one solution over another is inductive bias

27 of 32

Measuring performance

  • MNIST1D dataset model and performance
  • Noise, bias, and variance
  • Reducing variance
  • Reducing bias & bias-variance trade-off
  • Double descent
  • Curse of dimensionality & weird properties of high dimensional space
  • Choosing hyperparameters

​

28 of 32

Curse of dimensionality

  • As dimensionality increases, the volume of space grows so fast that the amount of data needed to densely sample it increases exponentially. This phenomenon is known as the curse of dimensionality.

​

29 of 32

Measuring performance

  • MNIST1D dataset model and performance
  • Noise, bias, and variance
  • Reducing variance
  • Reducing bias & bias-variance trade-off
  • Double descent
  • Curse of dimensionality & weird properties of high dimensional space
  • Choosing hyperparameters

​

30 of 32

Choosing hyperparameters

  • Don’t know bias or variance
  • Don’t know how much capacity to add
  • How do we choose capacity in practice?
    • Or model structure
    • Or training algorithm
    • Or learning rate
  • Third data set – validation set
    • Train models with different hyperparameters on training set
    • Choose best hyperparameters with validation set
    • Test once with test set

​

31 of 32

K-Fold Cross-Validation

32 of 32

Grid Search