# Coding A Neural Network From scratch Part 5 - Training The Network | Summary and Q&A

1.7K views
July 13, 2017
by
Machine Learning with Phil
Coding A Neural Network From scratch Part 5 - Training The Network

## TL;DR

Learn how to build a neural network from scratch, including feed-forward, prediction, and gradient calculation, achieving a 91% training accuracy.

## Key Insights

• 🤱 The tutorial demonstrates the step-by-step implementation of a neural network, covering feed-forward calculations, prediction generation, gradient calculation, and training.
• 🚐 Shuffling the training data and using mini-batches are important practices for better training performance.
• ☠️ The learning rate, epoch, and batch size are hyperparameters that can be adjusted to improve the model's performance.
• ❓ This implementation achieves a training accuracy of 91% but may require further modifications to enhance accuracy.

### Q: What is the purpose of the feed-forward function in a neural network?

The feed-forward function calculates the values of all the units (A's and Z's) in the neural network, going from the input layer to the output layer. It computes the output of each unit based on the weights and biases.

### Q: How is the prediction generated in a neural network?

The prediction is generated by finding the position of the output unit with the highest probability. Since the output layer uses a sigmoid function that outputs values between 0 and 1, the position with the maximum value represents the most likely answer for the input data.

### Q: What is the role of gradient calculation in a neural network?

Gradient calculation is essential for learning in a neural network. It involves backpropagation, where the error from the output layer is propagated backward through the model to update the weights and biases. This process helps the model adjust its parameters to minimize the cost function.

### Q: How is the training accuracy calculated in the provided code?

The training accuracy is calculated by comparing the predicted labels with the actual training labels and determining the percentage of correct predictions. It gives an indication of how well the model performs during training.

## Summary & Key Takeaways

• The tutorial covers the implementation of a neural network from scratch, focusing on feed-forward calculations, prediction generation, and gradient calculation for learning.

• The tutorial emphasizes the importance of dimensionality and bias units in the weight matrices.

• The code provided shuffles the training data, initializes the weights, trains the model using mini-batches, and tracks the training accuracy.