Neural Network Basics Flashcards

1
Q

Describe the Step Function, is it suitable for NN training?

A

1 if x>0, 0 otherwise. It helps to introduce nonlinearities

No, its not suitable for NN training

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe the ReLU function, is it commonly used? if so, why?

A

relu(x) = max (0, x)
Yes, most commonly in modern architectures, because its very easy to compute, yet offers enough capability to build complex models

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe the Sigmoid/Logistic Function
Where is it most important nowdays?

A
  • Output in a specific range (0 & 1)
    sigmoid(x) = 1/(1+e^x)
  • Nowadays mostly important in output neurons
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe the tanh(x) function and its output

A

tanh(x) = 2 · sigmoid(2 · x) – 1
output is between -1 and 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe the type of layers in a multilayer perceptron

A

Types of layers
– Input layer: Contains the inputs (e.g.,
pixel values of an image)
– Hidden layer: Internal layer of the network
– Output layer: Produces the outputs (e.g., classification probabilities)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How is the calculation performed in a MLP (multilayer perceptron)?

A

(neuron*weight) + bias

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What’s inferencing?

A

Is using a model after training for new predictions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Whats the difference Metric vs. loss?

A

– Metric: What we (as humans) actually care about
– Loss: Drive automated learning; compromise between metric and a differentiable function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What’s the central loop in training all deep learning models? (Draw it & explain it)

A
  • Init: Initialize the weights in some way, e.g., randomly
    – Predict: Predict outputs with the current weights
    – Loss: Compute how good the model performs
    – Gradient: For each weight, how does changing it slightly affect the loss?
    – Step: Adjust weights according to gradient
    – Repeat until some stop condition is met
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

why gradients and the learning rate are important?

A

Gradients provide the direction for minimizing the loss function, guiding the parameter updates. The learning rate controls the step size of these updates, balancing the speed and stability of the learning process. Choosing appropriate values for these components is crucial for successful neural network training, as they directly impact the model’s ability to learn and generalize from data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which statement is true about the origins of neural networks?

  • Neural networks were inspired by evolution. The training procedure (also called “fitting”) is a close resemblance of the “survival of the fittest”, where the best found solution improves over time due to evolutionary pressure.
  • Neural networks were inspired by the brain and they closely model the neurons and their connections in the brain.
  • Neural networks weren’t inspired by any biological analogy, the naming is rather a coincidence.
  • Neural networks were inspired by biological neurons and their connections, but they remain a simplification of their biological counterparts.
A

Neural networks were inspired by biological neurons and their connections, but they remain a simplification of their biological counterparts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

You want to implement a neural network with the following specification:

  • 5 input values, 10 output values
  • one hidden layer of size 20, then a hidden layer of size 10

The network should first use a ReLU activation function, then a sigmoid and then a tanh at the output.

Provide the PyTorch code to implement this network

A

nn.Sequential(
nn.Linear(5, 20),
nn.ReLU(),
nn.Linear(20, 10),
nn.Sigmoid(),
nn.Linear(10, 10),
nn.Tanh()
)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

You are given the following neural network defined in PyTorch:

nn.Sequential(

nn.Linear(9,13),

nn.ReLU(),

nn.Linear(13,3),

nn.Sigmoid()

)

What is the total number of parameters created by this model?

A

(9x13) + 13 +(13*3)+ 3 = 172

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which statements are correct about metrics and loss functions? (Multiple Choice)
1. The metric is used in the training process to compute the loss function.
2. The loss function is the gradient of the parameters.
3. The loss function is generally the same as the metric.
4. The metric is used in the training process to give human feedback about model performance.
5. The loss function is usually similar to a metric, but it needs to be differentiable.

A

4 & 5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Who first proposed the concept of artificial neurons, then called perceptrons?
a) Hinton and Salakhutdinov
b) McCulloch and Pitts
c) LeCun and Bengio
d) Hochreiter and Schmidhuber

A

Answer: b) McCulloch and Pitts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Given a neural network with 2 inputs, 1 hidden layer of 3 neurons, and 1 output, where each neuron in the hidden layer has weights [0.5, -0.6] and biases [0.1, -0.2, 0.3]. Calculate the output of the first hidden neuron given inputs [1, -1] using a ReLU activation function.

A

The weighted sum for the first hidden neuron is (10.5) + (-1-0.6) + 0.1 = 0.5 + 0.6 + 0.1 = 1.2. The ReLU activation function outputs max(0, 1.2) = 1.2.

17
Q

Explain why activation functions are essential in neural networks and describe the main advantages of using the ReLU activation function.

A

Answer: Activation functions introduce non-linearity into the neural network, allowing it to learn complex patterns. The ReLU activation function is computationally efficient, helps mitigate the vanishing gradient problem, and allows the network to converge faster.

18
Q

Which of the following activation functions can produce output values between -1 and 1?
a) ReLU
b) Sigmoid
c) Tanh
d) Step

A

Answer: c) Tanh

19
Q

For a simple multi-layer perceptron with 2 input neurons, 1 hidden layer with 2 neurons, and 1 output neuron, calculate the total number of parameters (weights and biases) assuming fully connected layers.

A

Answer: The number of weights between input and hidden layer is 22 = 4. The number of weights between hidden and output layer is 21 = 2. The total number of biases is 2 (hidden layer) + 1 (output layer) = 3. Total parameters = 4 (weights) + 2 (weights) + 3 (biases) = 9.

20
Q

Describe the process of backpropagation and its role in training neural networks.

A

Answer: Backpropagation is an algorithm used to minimize the error by adjusting the weights and biases in the network. It involves computing the gradient of the loss function with respect to each parameter and updating the parameters in the opposite direction of the gradient to reduce the loss.

21
Q

In a multi-layer perceptron (MLP), what does the hidden layer do?
a) Contains the raw input data
b) Produces the final output
c) Learns intermediate representations
d) None of the above

A

Answer: c) Learns intermediate representations