Determining the Amount of Data to Learn at Once - Batch Size
When studying, tackling many problems at once can lead to decreased focus and inefficiency.
Conversely, moving too slowly by studying one problem at a time can make it difficult to complete the overall syllabus.
Similarly, when training a machine learning model, the hyperparameter that determines the amount of data used in a single training step is called Batch Size.
Batch size determines how much data the model will learn from in a single update.
Why Batch Size is Important
The model learns by receiving data and adjusting the weights.
The way the model processes data changes depending on the batch size.
When the Batch Size is Too Small
Small amounts of data are used in a training step, so memory usage is low.
However, the model frequently updates the weights, which can lead to unstable training.
It may also take a long time to find the optimal weights.
When the Batch Size is Too Large
Using a large amount of data in a training step results in more stable learning.
But, it increases memory usage and can slow down the weight updates.
How to Set the Batch Size
Batch sizes are typically powers of two, like 32, 64, 128, which are favorable for optimizing calculations on hardware accelerators such as GPUs.
When setting the batch size, consider the following points.
In the next lesson, we will learn about epochs, which determine how many times the model will learn the entire dataset.
Lessons in this chapter · How Machine Learning Models Work
- 1. How AI Models Learn
- 2. Training Dataset: Learning Patterns
- 3. Validation Dataset: Tuning the Model
- 4. Test Dataset: Final Performance Check
- 5. Multiple Choice Quiz
- 6. Hyperparameters: Key to Model Performance
- 7. Learning Rate: Controlling Training Speed
- 8. Batch Size: How Much Data to Learn at Once
- 9. Epochs: Number of Times to Train
- 10. Overfitting: A Closer Look
- 11. Underfitting: A Closer Look
- 12. Fill-in-the-Blank Quiz
- 13. What Is the Purpose of ML Models?
- 14. Classification Models: Grouping Data
- 15. Accuracy: Measuring Prediction Quality
- 16. Precision: Measuring Correctness of Positive Predictions
- 17. Recall: Measuring Coverage of Positive Predictions
- 18. F1-Score: Balancing Precision and Recall
- 19. Multiple Choice Quiz
- 20. Regression Models: Predicting Continuous Values
- 21. Mean Squared Error (MSE)
- 22. Mean Absolute Error (MAE)
- 23. R-Squared (R²)
- 24. Fill-in-the-Blank Quiz
In general, when the batch size is small, the learning burden is reduced, allowing the model to converge faster.
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help