1What does backpropogation solve?
1) Allows us to calculate gradients (derivatives) efficiently
2) Helps us initialize parameters to avoid huge losses, and avoid extremely large or small gradients
2What are the two steps of backpropogation?
Forward pass and Backwards pass
3What does the Forward pass do?
The network processes the input data and computes the activations of all hidden units layer by layer until the output is obtained. (Like betas and omegas)
The activations at each layer are saved to be used during the second phase of backpropagation to compute the gradients efficiently.
4What does the Backwards Pass do?
The network uses the stored activations from the backwards pass to compute the gradients of the loss with respect to each parameter efficiently.
This is done by propogating the error from the output layer back through the network to the input layer.
5What are the problems with parameter initialization?
- Vanishing gradient: gradients and weights will get smaller and smaller (if the variance is very small)
- Exploding Gradient: If the variance is very large, then each weight or element (like beta or omega) will get very large, much larger magnitude than the inputs.
In either scenario we run into the problem of floating point numbers not being able to repersent the artithmetic.
Goal: $h_k \approx h_{k-1}$
6What is He initalization?
• Variance scaling: He initialization compensates for ReLU's halving effect by doubling the variance of the random weights.
• Formula: The weights are initialized from a zero-mean distribution (Gaussian or uniform) scaled by the number of input connections ($(n_{in}\)$.
7What is Algorithmic differentiation?
When deep learning frameworks like Pytorch calculate the derivatives automatically. Each functional component in the framework knows how to compute its own derivative. These frameworks use parallelization with modern GPUs do do these things quickly.
8What is the overarching goal of the performance of a model?
Generalization, we wnat our trained model to perform well not just on the training data but also in unseen test data.
9What are the three types of test errors?
1) Inherent uncertainty
2) Amount of training data
3) Choice of model
10What is the point of the Training set of data?
It allows the model to learn the task, used to fit the model parameters. Helps learn model parameters with things like stochastic gradient descent.
11What is the point of the validation set of data?
It helps choose which model is the best, helps tune hyperparameters and make decisions surrounding the model architecture. Like comparing the number of layers of nuerons.
12What is the point of the test set of data?
Used to evaluate the final model's generalization performance.
13What is Overfitting?
The model performs well on the training data but fails to generalize to unseen data.
What can happen is the training loss decreases steadily toward zero, then the test loss decreases a first but then subsequently increases as the model becomes increasingly confident about its (wrong) predictions.
14What are the three sources of error?
Noise, Bias, and Variance.
15What is Noise?
There are multiple possible valid outputs y for each input x
May arise when:
- There is a genuine stochastic element to the data generation process
- Because some of the data is mislabled
- Because there are further explanatory variables that were not observed
16What is Bias?
The model is not flexible enough to fit the true function perfectly, the error introduced by approximating a real-world problem, which may be complex, by a simplified model. Can cause underfitting, where the model is too simple to capture the underlying patterns in the data.
- Can be fixed by adding more layers or nuerons
17What is Variance?
When we have limited training examples, and there is no way to distinguish systematic changes in underlying function from noise in the underlying data.
- Can be fixed by adding more training data
18What is the Bias-Variance trade off?
For fixed-size training data, the variance typically increases as the model capacity increases. So by trying to solve the bias of the data by increasing the number of hidden layers, we increase the variance.
19How do we choose hyperparameters?
Usually chosen empirically, we train the models with different parameters and keep the one that performs the best. Use validation set to test trained model on then modify hyperparameters.
20What is accuracy?
Accuracy is the proportion of correct predictions. It is the number of correct predictions divided by the total number of predictions.
$Accuracy = \frac{\text{Number of correct predictions}}{\text{Total number of predictions}}$
- it is a good metric when classes are balanced, a bad metric when not.
- ex: a model gets 95% accuracy when predicting the same class for a dataset that is 95% that class
21For a Binary Classifier, what are the four possible outcomes of accuracy?
True Positive (TP): Correctly predicted the positive class
False Positive (FP): Incorrectly predicted the negative class as positive
True Negative (TN): Correctly predicted the negative class
False Negative (FN): Incorrectly predicted the positive class as negative
$Accuracy = \frac{TP + TN}{TP + TN + FP + FN}$
22What is Precision?
The proportion of positive predictions that are correct.
$Precision = \frac{TP}{TP + FP}$
23What is Recall?
The proportion of positive instances that are correctly predicted
$Recall = \frac{TP}{TP + FN}$
24What is bad about a model with perfect precision but poor recall?
Predicts positives only when it's absolutley certain, so it never makes a false positive, but misses most true positives.
25What is bad about a model with poor precision but good recall?
Predicts many more positives than truly exist, catching almost all real positives but generating many false alarms.
26What is F1 Score?
A harmonic mean of the precision and recall?
$F1-Score = 2 \times \frac{Precision \times Recall}{Precision + Recall}$
27What is Mean Aboslute Error (MAE)?
The average of the absolute differences between the predicted and the actual values
$\frac{1}{n} \sum_{i=1}^{n} |y_i - \hat{y}_i|$
28What is Mean Squard Error (MSE)?
The average of the squared differences between the predicted and actual values
$\frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2$
29What is Cross-Validation?
A technique used to asses how the results of a statistical analysis will generalize to an independent dataset. Common example method: k-fold cross-validation.
30What is Regularization?
A family of methods that reduce the generalization gap between training and test performance.
Strictly speaking, regularization involves adding explicit terms to the loss function that favor certain parameter choices, however this term is commonly used to refer to any strategy that improves generalization.
31What is L2 Regularization?
L2 punishes the sum of the squares of the parameter values, favoring smaller parameter values. Is usually applied to the weights but not the biases and is hence referred to as a weight decay term.
$g[\phi] = argmin \sum_{i=1}^{n} l_i[x_i,y_i] + \lambda \sum_{j}\phi^2_j$
32What is Early Stopping?
Refers to stopping the training prodcedure of a model before it has fully convereged.
This can reduce overfitting if the model has already captured the coarse shape of the underlying function but has not yet had time to overfit to the noise.
33What is Ensembling?
Another approach to reducing the generalization gap. To build several models and average their predictions, a group of such models is known as an ensemble. Reliably improves test performance at the cost of training and storing multiple models and performing ingerence multiple times.
You can train different models through random initialization or re-sampling the training data.
34What is Dropout?
Another approach to reducing generalization gap. Dropout clams a random subset (typically 50%) of hidden units to zero at each iteration of SGD. This makes the network less dependent on any given hidden unit and encourages the weights to have smaller magnitudes so that the change in the function due to the presence or absence of any specific hidden unit is reduced.
35What is transfer learning?
When training data is limited, other datasets can be expoited to improve performance. In transfer learning, the network is pretrained to perform a related secondary task for which data are more plentiful. The resulting model is then adapted to the original task.
36What is multi-task learning?
A network is trained to solve several problems concurrently. Some things are learned better when done simulataneously.
37What is self-supervised learning?
Two Types: Generative and Constrastive
Generative: Part of each data example is masked, and the secondary task is to predict the missing part
Constrastive: Pairs of examples with commonalities are compared to unrelated pairs.
38What is Augmentation?
When we want to expand the dataset, but we are limited.
We can often transform each input data example in such a way that the label stays the same, like rotating or flipping and image horizontally.