# Introduction to Data Science, ML and Deep Learning - Deeplearning540
Team 7
New fixed Zoom room : https://cern.zoom.us/j/61741701178?pwd=djYyRTR3K2RQSEMxbE1HNG5yNTljUT09
Mattermost: https://mattermost.web.cern.ch/terascale-ml/channels/group-7
Indico: https://indico.desy.de/event/28296/timetable/
**Exercises** and resources: https://deeplearning540.github.io/index.html
Lession videos can be downloaded and played or, if you have VLC, you can stream them using the menu item Media (on the top left) -> "Open Network Stream...".
Tensorflow playground: https://playground.tensorflow.org
ROC curve visualizations and explanations: https://github.com/dariyasydykova/open_projects/tree/master/ROC_animation
## Lessons
- Lesson 00: Preface
- Lesson 01: Diving into Regression [video](https://indico.desy.de/event/28296/contributions/99576/attachments/64395/79079/deeplearning540-lesson01-2021-02-19_17.59.48.mkv), [learner notebook](https://github.com/deeplearning540/lesson01/blob/main/lesson.ipynb), [full script](https://github.com/deeplearning540/deeplearning540.github.io/blob/main/source/lesson01/script.ipynb)
- Lesson 02: Enter Clustering [video](https://indico.desy.de/event/28296/contributions/97975/attachments/64396/79084/deeplearning540_lesson02-2021-02-22_23.30.44.mkv), [learner notebook](https://github.com/deeplearning540/lesson02/blob/main/lesson.ipynb), [full script](https://github.com/deeplearning540/deeplearning540.github.io/blob/main/source/lesson02/script.ipynb)
- Lesson 03: From Clustering To Classification [video part 1](https://indico.desy.de/event/28296/contributions/97976/attachments/64398/79089/deeplearning540_lesson03-2021-02-23_23.14.33_part1.mkv), [video part2](https://indico.desy.de/event/28296/contributions/97976/attachments/64398/79097/deeplearning540_lesson03-2021-02-23_23.50.39_part2.mkv), [learner notebook](https://github.com/deeplearning540/lesson03/blob/main/lesson.ipynb), [full script](https://github.com/deeplearning540/deeplearning540.github.io/blob/main/source/lesson03/script.ipynb)
- Lesson 04: Classification Performance ROCs [video](https://indico.desy.de/event/28296/contributions/97977/attachments/64400/79098/deeplearning540_lesson04-2021-02-24_18.09.02.mkv), [learner notebook](https://github.com/deeplearning540/lesson04/blob/main/lesson.ipynb), [full script](https://github.com/deeplearning540/deeplearning540.github.io/blob/main/source/lesson04/script.ipynb)
- Lesson 05: Neural Networks as Code [video](https://indico.desy.de/event/28296/contributions/97977/attachments/64400/79101/deeplearning540_lesson05-2021-02-25_17.48.08.mkv), [learner notebook](https://github.com/deeplearning540/lesson05/blob/main/lesson.ipynb)
- Lesson 06: How did we train [video](https://indico.desy.de/event/28296/contributions/98225/attachments/64451/79196/deeplearning540_lesson06-2021-01-03_233847.mkv), no jupyter notebook for this lesson
- Lesson 07: CNNs [video part 1](https://indico.desy.de/event/28296/contributions/98226/attachments/64470/79239/deeplearning540_lesson07_part1-2021-03-02_17.11.15.mkv), [video part 2](https://indico.desy.de/event/28296/contributions/98226/attachments/64470/79240/deeplearning540_lesson07_part2-2021-03-02_17.39.37.mkv), [learner notebook](https://github.com/deeplearning540/lesson06/blob/main/lesson.ipynb), [full script](https://github.com/deeplearning540/deeplearning540.github.io/blob/main/source/lesson07/script.ipynb)
- Lesson 08: Deep Learning (Exercise only) https://deeplearning540.github.io/lesson08/content.html
## Check yourself questions
### Lesson 1
In the following, the order of steps was confused, please rearrange
- collect training data, compute accuracy, predict new data, fit training data
- compute accuracy, collect training data, predict new data, fit training data
- collect training data, fit training data, compute accuracy, predict new data + 7 ||
- collect training data, predict new data, fit training data, compute accuracy
The least squares method for an input data pair `x` and `y` derives it’s name as it …
- Minimizes the sum of the product of `x * y`
- Minimizes the sum of the absolute difference between y and the predicted y_hat
- Minimizes the sum of the squared difference between y and the predicted y_hat ||||||
- Minimizes the sum of `y ** 2` and `x ** 2`
NaN stands for not-a-number. When loading a dataset with `pandas`, NaN values occur in the loaded data because …
- Input files contain string values in a column
- Computational Problems occurred, like computing the square root of a negative number ||||||
- Data could not be parsed correctly when reading input files into memory |
- there was no internet connection
### Lesson 2
You are provided a table of measurements from a weather station. Each measurements comes with values for temperature, precipation, cloud structure, date, humidity, and a quality ID. The latter tells you if the instrument was performing OK. You’d like to learn an algorithm that is able to predict the quality ID (5 possible integer values from 0 to 4) for any new data coming in. This falls into …
- Supervised Learning | |||| |
- Unsupervised Learning
- Reinforcement Learning
You are given a dataset of iris flowers. The data set consists of 50 samples from each of three species of Iris (Iris setosa, Iris virginica and Iris versicolor). Four features were measured from each sample: the length and the width of the sepals and petals, in centimeters. Which of the following feature combinations lend themselves for clustering? See this overview plot for help. https://upload.wikimedia.org/wikipedia/commons/thumb/5/56/Iris_dataset_scatterplot.svg/1024px-Iris_dataset_scatterplot.svg.png
https://s3.amazonaws.com/assets.datacamp.com/blog_assets/Machine+Learning+R/iris-machinelearning.png
- Sepal.Length versus Sepal.Width
- Sepal.Length versus Petal.Width
- Petal.Length versus Petal.Width |||||
- Sepal.Width versus Petal.Width (|)
You are helping to organize a conference of more than 1000 attendants. All participants have already paid and are expecting to pick up their conference t-shirt on the first day. Your team is in shock as it discovers that t-shirt sizes have not been recorded during online registration. However, all participants were asked to provide their age, gender, body height and weight. To help out, you sit down to write a python script that predicts the t-shirt size for each participant using a clustering algorithm. You know that you can only get 7 t-shirt sizes (XS, S, M, L, XL, XXL). This falls into:
- Supervised Learning
- Unsupervised Learning |||||||
- Reinforcement Learning
### Lesson 3
When using the k-Nearest-Neighbor (kNN) algorithm for classifying a query point x_q, the k stands for:
- the number of neighbors that must have a given label for the query point to get this label assigned || ||||
- the number of classes occurring in the data set
- the number of observations that define a neighborhood |
- the number of clusters in the dataset
When going through tutorials and exercises that discuss the k-Nearest-Neighbor (kNN) method, you observe that k is typically chosen to be an odd number. Checking the code, sklearn also access even numbers for k. Why do people tend to choose odd numbers?
- tradition that often works best in practice |
- odd numbers prevent ties from happening with the majority vote | |||
- this way, the total number of samples in the neighborhood is always even as one has to add the query sample
- odd numbers prevent ties from happening with the plurarity vote |
What is the majority vote and the plurality vote if the 8 nearest neighbors to your unknown data point are of the following classes:
class 1: 3, class 2: 2, class 3: 2, class 4: 1
majority vote:
- 1
- 2
- 3
- 4
- None | |||||
plurality vote:
- 1| | ||||
- 2
- 3
- 4
- None
### Lesson 4
The ROC acronym stands for
- Receiver Operator Curve
- Receiving Operates Curves
- Receiver Operating Characteristic |||||||
- Reception Occlusion Characteristic
Fill in the blanks!
A k-Nearest-Neighbor (kNN) classifier can produce a probability when predicting the class label of an unseen sample x_q. This can be achieved by counting class _______ in the training set neighborhood of this query point.
- labels
For a k=7 neighborhood, the threshold to decide for any given class in this neighborhood is calculated as 4/7 (majority vote). In the same setting (k=7), let’s assume we find 5 labels for class 1 and 2 labels for class 0. This means, that we get two probabilities, which are _____ for class 1 and _____ for class 0.
~71%
~29%
### Lesson 5
A hidden layer of an artificial neural network consists of a fixed set of parts. These are …
- weights W and a bias term b⃗
- weights W and an activation function F
- a bias term b⃗ and an activation function F
- weights W, a bias term b⃗ and an activation function F ||||||
Unlike scikit-learn, keras is a machine learning framework that …
- offers one-stop-shop prepared networks that are already published
- offers building blocks to construct neural networks on CPU or GPU architectures |
- offers an API to either wrap around backends (keras library) or represents the high-level API for tensorflow |
- all of the above ||||
### Lesson 6
The advantage of mini-batched based optimisation compared to online gradient descent or full data set gradient descent is …
- a mini-batch represents the entire data set and hence is enough to optimize on
- the optimisation converges faster |||||
- the optimisation can be performed in memory independent of the data set size
- the optimisation will converge always into a global optimum
Categorical Cross-Entropy is part of a well-known divergence in statistics. A divergence is a method to compare two probability density functions. It provides a large value if two distributions are different and a small value if they are similar. This well-known divergance that spurs the Categorical Cross-Entropy is …
- Mean-Squared-Error divergence
- Negative-Log-Likelihood divergence
- Kullback-Leibler divergence| || ||
- Maximum-Mean-Discreptancy divergence
The gradient that is required for gradient descent is the gradient …
- of the loss function L with respect to the testset input data, df/dx, given the network parameters theta
- of the network f with respect to the input data, df/dx, given the network parameters theta
- of the network f with respect to the network parameters, df/dtheta, given the training data x
- of the loss function L with respect to the network parameters, df/dtheta, given the training data x |||||
### Lesson 7
The Flatten operation rearranges an input image (or feature map) into a sequence of numbers. How does it perform this?
- the pixel intensities are averaged per row and concatenated
- all rows of the input are added and provided as a result
- all columns of the input are concatenated (from top to bottom)
- all rows of the input are concatenated (from top to bottom)|||||
For an input image shape of 28x28 what is the shape of the feature map after running the image through a single 5x5 convolutional filter?
- 24x28
- 20x28
- 26x26
- 24x24|| |||
For an MNIST input image, how many parameters does a Conv2D layer require when being defined to produce 16 feature maps as output and a 3x3 neighborhood. How many parameters does a Dense layer with 16 outputs have? Compute the two parameter counts!
Conv2D: 160 = (9 + 1 (bias)) * 16
Dense: (28 * 28 + 1) * 16 = 12560