Fichas
NN1
Fichas del conjunto (50)
- 1How would you define machine learning?In class we discussed two definitions of Machine Learning.
(i) A.L. Samuel: 'ML is the field of study, that gives computers the ability to learn [WITHOUT BEING EXPLICITLY PROGRAMMED (6 pts)].
(ii) T. Mitchell: 'A computer is said to learn from [EXPERIENCE E (2 pts)] with respect to some [TASK T (2 pts)] and some [PERFORMANCE MEASURE P (2 pts)], if its performance on T as measured by P improves with E' - 2How would you classify machine learning algorithms (3 key words)?We discussed classification with respect to:
( i ) training: supervised, unsupervised, semisupervised, reinforcement learning (4 pts)
(ii ) learning: online (incrementally) vs. batch (4 pts)
(iii) generalization: instance based vs. model based (4 pts) - 3What is meant by stating that machine learning is a 'paradigm shift'?Conventional approach (6 pts):
Rules + Data -> Programming -> Answers
Machine learning approach (6 pts):
Data + Answers -> Machine Learning -> Rules - 4In a Reinforcement Learning Setup, how is the knowledge needed for solving a task represented once the agent has been trained successfully?(i) Agent maintains a policy (4 pts)
(ii) Policy takes state of system as argument and returns best action (4 pts)
(iii) After successful training, the policy is optimal for a given task and produces the best possible action for every state of the system (4 pts) - 5What problems can be solved with unsupervised learning? Can you give examples?Unsupervised learning can be used for:
(i) Clustering, outlier detection,... (3 pts)
(ii) Dimensional reduction/visualization (3 pts)
Examples:
(i) Form groups of similar customers to tailor advertising (3 pts)
(ii) Reduce number of features for a given problem, say, for a car data set one might have engine power in hp and kW, using PCA, etc (3 pts) - 6Can you give an example application for a dense NN, a CNN and an RNN?Unsupervised learning can be used for (just examples, feel free to pick your own):
- dense NN: regression task (predicting house prices) (4 pts)
- CNN: Image classification task (cat classifier) (4 pts)
- RNN: Time series analysis task (translation) (4 pts) - 7Can you describe how Reinforcement Learning works?Reinforcement Learning consists of the following elements:
( i ) Agent (entity to be trained) (2 pts)
( ii) Actions (performed by Agent) (2 pts)
(iii) Environment (Agent lives in) (2 pts)
The Agent lives in an environment, observes, performs actions and receives a reward. (3 pts)
The Agent's goal is to maximize the expected cumulative reward. (3 pts) - 8What is the difference between Batch Learning and Online Learning? What are the pros and cons?(i) Batch learning
All of the data is used to train the system. (3 pts)
If the data distribution changes, the system has to be re-trained. (3 pts)
(ii) Online Learning
The system is trained on one data sample a time (or on mini batches) (3 pts)
System can be used in scenarios where quick adaption is necessary, like stock market (3 pts)
This approach can also help if computer memory is an issue (out-of-core learning) - 9What is Instance Based Learning and what is Model Based learning?(i) Instance Based Learning
Requires a measure of similarity (3 pts)
The system can then classify unseen data by assigning it to the category
of the most similar, known example. (3 pts)
(ii) Model Based Learning
In model based learning, the generalization is built upon a model trained on the data (3 pts)
This allows for predictions beyond the known data points, but requires checks of the model's performance (3 pts) - 10What data related challenges are we facing in machine learning?(i) Lack of data (3 pts)
(ii) Non-representative data (3 pts)
(iii) Sampling Bias (3 pts)
(iv) Noisy data (3 pts) - 11What algorithm related challenges are we facing in machine learning, and how can we address them?( i) Overfitting (high variance) (3 pts)
Address by introducing more data and/or by reducing the complexity of the system (3 pts)
(ii) Underfitting (high bias) (3 pts)
Address by introducing more complexity and/or feature engineering (3 pts) - 12Why is accuracy often not a good measure for evaluating the performance of a model?- assume we have a classification problem with a skewed data set (much more members of one class than of the other in a binary classification problem) (6 pts)
- if we have 95 percent of class 1 and 5 percent of class 0, always predicting class 1 will yield a 95 percent accuracy (6 pts) - 13What are training, test and validation set?( i ) Training set usually 80 percent of data (but not a strict rule), used to train model
( ii) Validation set used to evaluate the model on unseen data
(iii) Test set needed, because if hyperparams have to be tuned, the best system
that is being developed on train and val set only is just the best system for those two sets.
Thus, an additional hold-out set is required to test the ultimate performance of the system. - 14How would you evaluate the performance of a classification model?- Confusion matrix (4 pts)
- precision and recall (4 pts)
- f1 score (4 pts) - 15What are categorical variables and how can you deal with them?Categorical variables are non-numerical entries in data sets. (3 pts)
In order to deal with categorical variables, we can use encoding schemes. (3 pts)
The best way of addressing this is by using 1-hot encoding (3 pts).
The reason why we use 1-hot rather than integers is, that we do not want to have any relationship among the categories (as would be implied by the order relation on integers, for example). (3 pts) - 16How can you deal with missing values?In order to deal with missing values, one can use various imputation strategies. (3 pts)
Depending on the data set, the variable that has missing values, as well as how many values are missing, one can (3 pts)
- remove the lines that have missing values or omit the variable that's affected (3 pts)
- replace the missing entries with the median, mean value (3 pts) - 17What is the precision - recall tradeoff?- classification decisions are based on a threshold (4 pts)
- changing the threshold changes precision and recall (4 pts)
- however, they can not be changed individually (4 pts) - 18What is ROC and AUC?- Receiver Operator Characteristic Curve (ROC Curve)(4 pts)
- Plot True Positive Rate vs False Positive Rate (4 pts)
- Area under (ROC) Curve (AUC), can be used to compare classifiers(4 pts) - 19How do you solve a linear regression problem?- Have a data set of tuples (xi,yi) (2 pts)
- Introduce a linear model, e.g. yp = alpha + beta x (2 pts)
- Introduce a cost function, e.g. mean squared error sum_i^m (yp_i - y_i)^2 (2 pts)
- Plug model in cost function (2 pts)
- compute derivatives of cost function w.r.t. parameters (2 pts)
- demand derivatives to be zero and solve for parameters (2 pts) - 20Why does the minimization of a cost function (e.g. mean squared error) yield an optimal set of parameters?- cost function (MSE) is a function of labels y and predictions yp (3 pts)
- cost function measures agreement between prediction and labels (3 pts)
- prediction yp is a function of model parameters (3 pts)
- optimal parameters bring yp as close to y as possible, thus finding this minimum corresponds to finding optimal parameters (3 pts) - 21What is the sigmoid function g(z) and how does it look like?g(z) = 1/(1 + EXP(-z)) (6 pts)
(6 pts):
^
1.0| XXXXXXXXXXXXXX
|XX
XX 0.5
XX |
XX |
z - 22In class we discussed how an XOR gate can be learned with a neural network. Why can't this problem be solved with a linear model, and how does the neural network overcome this issue?- truth table XOR: (3 pts)
x1 x2 x1 XOR x2
0 0 0
0 1 1
1 0 1
1 1 0
- graphical feature representation: (3 pts)
x2
^
|
(0,1), 1 (1,1), 0
|
|
|
|
|
(0,0), 0--------(1,0), 1---> x1
- if model was linear with 3 parameters w1, w2 and b, we still can't solve the problem because the model is too constraining; looking at the plot, we see that when w1 is 0, w2 has to increase to produce an output of 1, whereas if w1 was 1, w2 would have to decrease to produce an output of 0. This cannot be solved with a linear model. (3 pts)
- neural networks overcome this problem because of the non-linear activation functions, thereby remapping the input features in such a way that the problem of the re-mapped features can be solved (in this case, then, even linearly) (3 pts) - 23How is a linear regression problem similar to how a neural network is being trained?As discussed in class, we could treat the search for the optimal parameters numerically. We then have:
- forward pass (compute predictions for data set using current parameters) (3 pts)
- evaluate cost function (3 pts)
- compute gradient (back propagation) (3 pts)
- update parameters (3 pts) - 24What activation functions do you know (name four)?( i) Sigmoid: 1/(1 + EXP(-z)) or draw (3 pts)
( ii) Tanh: (EXP(z) - EXP(-z))/(EXP(z) + EXP(-z)) or draw (3 pts)
(iii) ReLu: max(0,z) or draw (3 pts)
( iv) LeakyRelu: max(.01 z, z) or draw (3 pts) - 25Why does an activation function have to be non-linear?Non-linearity needed to learn non-linear functions (6 pts)
Because composition of linear function is a linear function (6 pts) - 26What are the key steps to train a neural network (formulas not required)?( i) Forward pass (Z = W X + b, A = g(Z)) (3 pts)
( ii) Compute the Loss (3 pts)
(iii) Compute the partial derivs. of Loss wrt params: dZ, dW, db (backpropagate) (3 pts)
( iv) Update the weights: W = W - alpha dW, b = b - alpha db (3 pts) - 27What is regularization and what types do you know (name three)?- Regularization addresses overfitting by ensuring that weights don't become too big (6 pts)
- L1 Regularization, L2 Regularization (3 pts)
- Dropout regularization (3 pts) - 28How does the convolution operation work? 3 0 1 2 7 4 1 5 8 9 3 1 1 0 -1 2 7 2 5 1 3 * 1 0 -1 = (work out first entry, upper left) 0 1 3 1 7 8 1 0 -1 4 2 1 6 2 8 2 4 5 2 3 9(12 pts)
3 0 1 2 7 4 -5 -4 0 8
1 5 8 9 3 1 1 0 -1 -10 -2 2 3
2 7 2 5 1 3 * 1 0 -1 = 0 -2 -4 -7
0 1 3 1 7 8 1 0 -1 -3 -2 -3 -16
4 2 1 6 2 8
2 4 5 2 3 9 - 29How do vertical edge detection kernels look like?- Vertical: (12 pts)
1 0 -1
1 0 -1
1 0 -1 - 30What is padding and what problem does it address?- Padding is used because the information at the edges of an image are is less often in the conv operation as the pixels in the center (4 pts)
- Therefore, one can use e.g. zero-padding (add zeros around the image) (4 pts)
- Control shrinking of image ( 4 pts) - 31What does this equation describe, and what is n, p and f? n X n * f X f -> n + 2p -f + 1 X n + 2p -f + 1- This is the output size of a padded conv (3 pts)
- n is the image size (3 pts)
- p is the padding size (3 pts)
- f is the filter size (3 pts) - 32What is valid convolution and what is same convolution? Hint: n + 2p -f + 1 X n + 2p -f + 1- Valid: Use p=0 -> n X n * f X f -> n - f + 1 X n - f + 1 (6 pts)
- Same: Pad such, that output size is the same as the input size (p=(f-1)/2) (6 pts) - 33What are Pooling layers, and what pooling types do you know, and how does backpropagation affect pooling?- Pooling is used to select the most important features from trained filters (3 pts)
- Max Pooling: Pick out the most dominant element from a sub-block (3 pts)
- Avg Pooling: Compute the average on a sub-block (3 pts)
- Backprop does not affect pooling, since it doesn't have any parameters associated with it (3 pts) - 34Draw a confusion matrix for a binary classification problem.(12 pts)
| predicted
-----------------------
a | | |
c | TN | FP |
t | | |
u |-------------------
a | | |
l | FN | TP |
| | |
----------------------- - 35What is the idea behind CNNs (how do they learn) and why are they better in image tasks than dense NNs?- CNNs are trained by learning filter elements (3 pts)
- The filters contain weights that can detect features in the image (3 pts)
- The filters are slid over the image using a stride, then the conv is performed (3 pts)
- CNNs are superior because the huge number of parameters/operations for NNs wouldn't be feasible (3 pts) - 36How is precision, recall and f1 score defined?- precision: TP / ( TP + FP) (4 pts)
- recall : TP / ( TP + FN) (4 pts)
- f1 : 2 precision *recall / (precision + recall) (4 pts) - 37How does a recurrent neuron differ from a neuron in a multilayer perceptron and what is 'unrolling' of the recurrent network in time?- additionally to input at time t, the recurrent neuron is also provided with the output of the neuron from the previous time step (6 pts)
- unrolling in time: re-writing the neuron in a dense network along a time dimension (6 pts) - 38How does a LSTM cell differ from a 'regular' recurrent neuron?- regular recurrent neuron takes previous output as input in addition to input x at time t (6 pts)
- LSTM takes two inputs in addition to the input x at time t: the long term memory cell input c and the short term memory cell h (6 pts) - 39What operation does back propagation implement and how is this usually implemented within a deep learning framework?- forward propagation leads to a nested structure of functions (functions of functions of functions, ...) (4 pts)
- back prop implements the chain rule of differential calculus to compute derivatives (4 pts)
- implementation through computational graphs in deep learning framework (4 pts) - 40What is the significance of the learning rate alpha? What if alpha is too small or too big?- learning rate corresponds to step size along gradient descent (4 pts)
- too small: may take a very long time to progress to minimum (4 pts)
- too big: may overshoot minimum and 'jump' around minimum (4 pts) - 41When you think of a multilayer perceptron, what hyper parameters can you think of and how can you find an optimal set of hyper parameters?- learning rate, neurons per layer, activation fcts, num of layers, dropout rate, batch size, ... (2 pts per parameter, max 6 pts)
- grid search (3 pts)
- random search (3 pts) - 42Can you name four applications for RNNs discussed in class (or any other)?- Speech recognition (3 pts)
- Sentiment classification (3 pts)
- Machine translation (3 pts)
- Name entity recognition (3 pts) - 43What types of RNN architectures do you know, and what would you use them for?- sequence to sequence, Tx=Ty, name entity recognition (4 pts)
- delayed sequence to sequence, Tx!=Ty, machine translation (4 pts)
- sequence to vector, pos/neg or star rating (4 pts) - 44If you have a dense NN with 3 input neurons, one hidden layer with 2 neurons, and one output neuron, how many parameters does this system have?- in between input and hidden layer: 2x3 matrix (6 params) + 2 bias units (2 params) (4 pts)
- in between hidden layer and output neuron 1x2 matrix ( 2 params) + 1 bias unit (1 param) (4 pts)
- total num of params is thus 6 + 2 + 2 + 1 = 11 params (4pts) - 45Can you name a problem related to weight updates that are one of the reasons why LSTMs have been introduced?- vanishing gradients are a problem occurring in RNNs (unrolling in time can lead to very deep models) (4 pts)
- parameters in shallow time layers are hard to update once gradients become very small (4 pts)
- LSTMs are addressing the problem of vanishing gradients (4 pts) - 46In an LSTM, how do the gates control the flow of information through the system?LSTMs:
- use simoid activations for gate output (4 pts)
- this maps output to interval (0,1) (4 pts)
- then use elementwise multiplication (4 pts) - 47How is an RNN trained?- Forward pass, common set of weights (3 pts)
- Compute loss (3 pts)
- Back Propagation Through Time (3 pts)
- Update weights (3 pts) - 48What type of long term correlations do you expect in language processing? Can you give an example?- Problem arises, because words at the beginning of a sentence could determine which word is to be used at end (singular/plural) (4 pts)
- The neural network course, which started in March of 2021, and which was totally awesome, was winding down. If it were 'courses', however, we would have to use 'were' instead of 'was' at the end of the sentence (4 pts)
- That would be an example of a long term correlation ( 4 pts) - 49How could name entity recognition be implemented with an RNN?- sequence to sequence model ( 3 pts )
- dictionary based encoding scheme for words ( 3 pts )
- input x are sentences (every word associated with a time step t) ( 3 pts )
- outputs yt are binary (word is a name or not a name) ( 3 pts ) - 50What 'gates' are implemented in LSTMs?LSTMs:
update gate (4 pts)
forget gate (4 pts)
output gate (4 pts)
Información
- Descripción
- Gib deiner Ressource einen passenden Titel, um deine Inhalte besser zu organisieren
- Creado por
- Maximilian Ceh
- Visitas
- 0
- Valoración