This PR refactors the training loop from a script to a class in order to improve code organization and reusability. The existing code in src/main.py is encapsulated into a new class named MNISTTrainer, which includes methods for loading and preprocessing the data, defining the model, training the model, and saving the trained model.
Summary of Changes
Created a new class named MNISTTrainer in src/main.py.
Moved the code for loading and preprocessing the data into a method named load_data.
Moved the code for defining the model into a method named define_model.
Created a new method named train_model to implement the training loop.
Created a new method named save_model to save the trained model.
Updated the script to create an instance of MNISTTrainer and call the methods in the correct order.
Added proper documentation with docstrings and comments for all methods.
Please review and merge this PR. Thank you!
Fixes #6.
🎉 Latest improvements to Sweep:
Sweep can now passively improve your repository! Check out Rules to learn more.
💡 To get Sweep to edit this pull request, you can:
Comment below, and Sweep can edit the entire PR
Comment on a file, Sweep will only modify the commented file
Edit the original issue to get Sweep to recreate the PR from scratch
Description
This PR refactors the training loop from a script to a class in order to improve code organization and reusability. The existing code in
src/main.py
is encapsulated into a new class namedMNISTTrainer
, which includes methods for loading and preprocessing the data, defining the model, training the model, and saving the trained model.Summary of Changes
MNISTTrainer
insrc/main.py
.load_data
.define_model
.train_model
to implement the training loop.save_model
to save the trained model.MNISTTrainer
and call the methods in the correct order.Please review and merge this PR. Thank you!
Fixes #6.
🎉 Latest improvements to Sweep:
💡 To get Sweep to edit this pull request, you can: