Deep Learning Foundations: Deep Dive

Deep Dive: Neural Network Mathematics

Let's delve deeper into the mathematics behind neural networks. Understanding these concepts is crucial for implementing and optimizing deep learning models.

1. Forward Propagation

Forward propagation is the process of passing input through the network to generate an output. For a single neuron:

y = f(Σ(w_i * x_i) + b)

Where:

  • y is the output
  • f is the activation function
  • w_i are the weights
  • x_i are the inputs
  • b is the bias

2. Activation Functions

We've mentioned these before, but let's look at their mathematical representations:

  • ReLU: f(x) = max(0, x)
  • Sigmoid: f(x) = 1 / (1 + e^(-x))
  • Tanh: f(x) = (e^x - e^(-x)) / (e^x + e^(-x))

3. Loss Functions

Loss functions measure the difference between the network's predictions and the actual values. Common loss functions include:

  • Mean Squared Error (MSE): L = (1/n) * Σ(y - ŷ)^2
  • Binary Cross-Entropy: L = -Σ(y * log(ŷ) + (1-y) * log(1-ŷ))

4. Backpropagation

Backpropagation uses the chain rule of calculus to compute the gradient of the loss function with respect to each weight:

∂L/∂w_i = ∂L/∂y * ∂y/∂z * ∂z/∂w_i

Where z is the weighted sum of inputs before the activation function.

5. Gradient Descent

Gradient descent updates the weights to minimize the loss:

w_new = w_old - η * ∂L/∂w

Where η is the learning rate.

Interactive Neural Network Demo

Adjust the weights and bias to see how they affect the output of a single neuron:

1
1
0

Comprehension Check

Which of the following is NOT a common activation function in neural networks?