Regularization

Any technique to reduce generalization error but not training error.

Parameter norm penalties:

J~=J+αΩ where the αΩ term describes the penalty.

We do not regularize biases, because they only affect the output. Regularizing weights can lead to underfitting. Weights are a relation between inputs and outputs, and thus require more datapoints to gather a relationship.

#L2 regularization

Ω=12||w||2

Gradient:

∇wJ~=∇wJ+αw∇ww=∇wJ+αw

Gradient step:

w←w−ϵ(αw+∇wJ)=w(1−ϵα)−ϵ∇wJ

w~=Q(Λ+αI)−1ΛQTw∗ so α rescales the eigenvalues by λ/(λ+α). Small λ are heavily penalized, large λ aren't.

#Linear regression

cost = ||Xw−y||2 and after applying L2 regularization, this becomes ||Xw−y||2+12α||w||2.

Solution becomes w=(XTX+αI)−1XTy, where 1mXTX is the covariance matrix.

Effectively adding α to each diagonal element (each variance increases); also useful for making the matrix non-singular.

#L1 regularization

Ω=||w||1=∑i|wi|

∇wJ~=∇wJ+asign(w)∇wJ~=H(w−w∗)

Assume H is diagonal (can be done using PCA). Using quadratic approximation,

J~=J+∑i12Hii(wi−wi∗)+α|wi|

The solution is

wi=sign(wi∗)max⁡{|wi∗|−aHii,0}

If |wi∗|<aHii, then wi=0, because J~ is overwhelmed by the regularization; otherwise it moves towards 0.

L1 regularization can set weights to zero (sparse).

Can be used for feature selection (e.g. LASSO).

#Explicit constraints vs. Penalties

Penalties can result in local minima with "dead" neurons, which have small weights in and out.

Constraints + descending on J and reprojecting is often more useful.

#Dataset Augmentation

Increase generalization by transforming training data to get more samples. Examples include:

#Noise Robustness

Noise encourages the algorithm to find areas stable to perturbations - local minima surrounded by flatness.

#Output Target Noise

You can also apply noise to the output.

Label smoothing: replace 0, 1 with ϵ/(k−1), 1−ϵ.

If using maximum likelihood, your algorithm may never converge and norm may go to infinity, so use a norm regularizer as well.

#Early Stopping

As epochs increase, validation error goes down and then up. We can stop training our model at the lowest validation set loss.

image-20211024155906475

Parameters that correspond to significant curvature are "more important" and are learned faster than parameters that correspond to less curvature.

#Parameter Sharing

Two different models can share parameters. This:

#Sparse Representations

Make the data in x sparse by applying some function f: y = Ax, where x has many zeroes.

#Bagging

Reduces generalization error by combining several different models.

Train the separate models, then have the models vote on the output.

This is an example of model averaging, and techniques employing this strategy are known as ensemble methods.

Why is this effective? Different models won't make the same errors (generally). Consider k models, each with an error e~i~ on each example such that 𝔼[ei2]=v and 𝔼[eiej]=c. Then, the expected error is

𝔼[(1k∑ei)2]=1k2𝔼[∑ei2+∑i≠jeiej]=1kv+k−1kc

If c=v, then we get the error is v, so it is no worse. However, for c≤v, the error decreases.

#Implementation

Bagging involves constructing k different datasets, each of which is a sample with replacement from the original dataset.

image-20211024154543692

Benchmarks usually omit bagging because every algorithm benefits from it. However, it is more memory/time intensive.

#Dropout

Removes units from a neutral network randomly.

In practice, this is done by randomly generating a random binary mask at each training step.

Similar to bagging - this method trains an exponential # of models without using much memory.

Another way to view droput:

#Weight Scaling Inference Rule

To predict a distribution p, it is necessary to normalize our prediction p~. To approximate this, we can multiply weights out of a node i by multiplying the probability of including i.

Empirically, this works very well, but there is no strong theoretical reason why it works (however, this is exact for linear models).

#Adversarial Training

image-20211024155405566

Given a model and a point x, search for a point x' near x such that the output is very different at x'.

This forces nonlinearity, because linear functions can be very sensitive to small e: e||w|| can be large, especially if w is high-dimensional.

#Tangent prop??

← All posts · View as Markdown