Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Deep Learning

Sheet 1 — DL
First topic questions

1. (a) How would you define Machine Learning?


(b) Can you name four types of problems where it shines?
(c) What is a labeled training set?
(d) What are the two most common supervised tasks?
(e) Can you name four common unsupervised tasks?
(f) What type of Machine Learning algorithm would you use to allow a robot to walk
in various unknown terrains?
(g) What type of algorithm would you use to segment your customers into multiple
groups?
(h) Would you frame the problem of spam detection as a supervised learning problem
or an unsupervised learning problem?
(i) What type of learning algorithm relies on a similarity measure to make predictions?
(j) What is the difference between a model parameter and a learning algorithm’s hy-
perparameter?
(k) What do model-based learning algorithms search for? What is the most common
strategy they use to succeed? How do they make predictions?
(l) Can you name four of the main challenges in Machine Learning?
(m) If your model performs great on the training data but generalizes poorly to new
instances, what is happening? Can you name three possible solutions?

2. For the following Datasets, perform tasks (a) , (b) and (c)

• Iris plants dataset


• Boston house prices dataset
• Diabetes dataset
• Optical recognition of handwritten digits dataset
(a) Loading the dataset.
(b) Summarizing the dataset.
(c) Visualizing the dataset.
(d) Evaluating some algorithms.
(e) Making some prediction

National Advanced School of Engineering, University of Yaounde I Page 1 of 5


Louis Fippo Fitime: louis.fippo.fitime@gmail.com
Deep Learning: Sheet 1— DL

3. What Linear Regression training algorithm can you use if you have a training set with
millions of features?

4. Suppose the features in your training set have very different scales. What algorithms
might suffer from this, and how? What can you do about it?

5. Gradient Descent
(a) Do all Gradient Descent algorithms lead to the same model provided you let them
run long enough?
(b) Can Gradient Descent get stuck in a local minimum when training a Logistic Re-
gression model?
(c) Suppose you use Batch Gradient Descent and you plot the validation error at every
epoch. If you notice that the validation error consistently goes up, what is likely
going on? How can you fix this?
(d) Is it a good idea to stop Mini-batch Gradient Descent immediately when the vali-
dation error goes up?
(e) Which Gradient Descent algorithm (among those we discussed) will reach the vicin-
ity of the optimal solution the fastest? Which will actually converge? How can you
make the others converge as well?

6. Suppose you are using Polynomial Regression. You plot the learning curves and you
notice that there is a large gap between the training error and the validation error.
What is happening? What are three ways to solve this?

7. Suppose you are using Ridge Regression and you notice that the training error and the
validation error are almost equal and fairly high. Would you say that the model suffers
from high bias or high variance? Should you increase the regularization hyperparameter
α or reduce it?

8. Why would you want to use:


(a) Ridge Regression instead of Linear Regression?
(b) Lasso instead of Ridge Regression?
(c) Elastic Net instead of Lasso?

9. Try to build a classifier for the MNIST dataset that achieves over 97% accuracy on the
test set. Hint: the KNeighborsClassifier works quite well for this task; you just need to
find good hyperparameter values (try a grid search on the weights and nn eighborshyperparameters).

National Advanced School of Engineering, University of Yaounde I Page 2 of 5


Louis Fippo Fitime: louis.fippo.fitime@gmail.com
Deep Learning: Sheet 1— DL

10. Write a function that can shift an MNIST image in any direction (left, right, up, or down)
by one pixel. Then, for each image in the training set, create four shifted copies (one per
direction) and add them to the training set. Finally, train your best model on this expanded
training set and measure its accuracy on the test set. You should observe that your model
performs even better now! This technique of artificially growing the training set is called
data augmentation or training set expansion.

11. Train an SVM classifier on the MNIST dataset. Since SVM classifiers are binary classifiers,
you will need to use one-versus-all to classify all 10 digits. You may want to tune the
hyperparameters using small validation sets to speed up the process. What accuracy can
you reach?

12. Load the MNIST dataset


(a) Split it into a training set and a test set (take the first 60,000 instances for training,
and the remaining 10,000 for testing).
(b) Train a Random Forest classifier on the dataset and time how long it takes, then
evaluate the resulting model on the test set.
(c) Next, use PCA to reduce the dataset’s dimensionality, with an explained variance
ratio of 95%.
(d) Train a new Random Forest classifier on the reduced dataset and see how long it
takes.
(e) Was training much faster? Next evaluate the classifier on the test set: how does it
compare to the previous classifier?

National Advanced School of Engineering, University of Yaounde I Page 3 of 5


Louis Fippo Fitime: louis.fippo.fitime@gmail.com
Deep Learning: Sheet 1— DL

13. (a) What are the main benefits of creating a computation graph rather than directly
executing the computations? What are the main drawbacks?
(b) Is the statement a val = a.eval(session=sess) equivalent to a val = sess.run(a) ?
(c) Is the statement a val, b val = a.eval(session=sess), equivalent to a val, b val =
sess.run([a, b]) ? b.eval(session=sess)
(d) Can you run two graphs in the same session?
(e) If you create a graph g containing a variable w , then start two threads and open
a session in each thread, both using the same graph g , will each session have its
own copy of the variable w or will it be shared?
(f) When is a variable initialized? When is it destroyed?
(g) What is the difference between a placeholder and a variable?
(h) What happens when you run the graph to evaluate an operation that depends on
a placeholder but you don’t feed its value? What happens if the operation does
not depend on the placeholder?
(i) When you run a graph, can you feed the output value of any operation, or just the
value of placeholders?

14. Implement Logistic Regression with Mini-batch Gradient Descent using TensorFlow. Train
it and evaluate it on the moons dataset Try adding all the bells and whistles:
(a) Define the graph within a logistic regression() function that can be reused easily.
(b) Save checkpoints using a Saver at regular intervals during training, and save the
final model at the end of training.
(c) Restore the last checkpoint upon startup if training was interrupted.
(d) Define the graph using nice scopes so the graph looks good in TensorBoard.
(e) Add summaries to visualize the learning curves in TensorBoard.
(f) Try tweaking some hyperparameters such as the learning rate or the mini-batch
size and look at the shape of the learning curve.

15. Why was the logistic activation function a key ingredient in training the first MLPs?

16. Name three popular activation functions. Can you draw them?

National Advanced School of Engineering, University of Yaounde I Page 4 of 5


Louis Fippo Fitime: louis.fippo.fitime@gmail.com
Deep Learning: Sheet 1— DL

17. Suppose you have an MLP composed of one input layer with 10 passthrough neurons,
followed by one hidden layer with 50 artificial neurons, and finally one output layer with 3
artificial neurons. All artificial neurons use the ReLU activation function.
(a) What is the shape of the input matrix X?
(b) What about the shape of the hidden layer’s weight vector Wh , and the shape of
its bias vector bh ?
(c) What is the shape of the output layer’s weight vector Wo , and its bias vector bo
?
(d) What is the shape of the network’s output matrix Y?
(e) Write the equation that computes the network’s output matrix Y as a function of
X, Wh , bh , Wo and bo .

18. How many neurons do you need in the output layer if you want to classify email into spam
or ham?
(a) What activation function should you use in the output layer?
(b) If instead you want to tackle MNIST, how many neurons do you need in the output
layer, using what activation function?

19. What is backpropagation and how does it work? What is the difference between backprop-
agation and reverse-mode autodiff?

20. Can you list all the hyperparameters you can tweak in an MLP? If the MLP overfits the
training data, how could you tweak these hyperparameters to try to solve the problem?

21. Train a deep MLP on the MNIST dataset and see if you can get over 98% precision.

National Advanced School of Engineering, University of Yaounde I Page 5 of 5


Louis Fippo Fitime: louis.fippo.fitime@gmail.com

You might also like