This repository contains the coding practice for the book Deep Learning from Scratch. The main focus of this repository is to use unit tests extensively for the methods chapter by chapter. This structure allows the repository to serve as a self-paced coding exercise for the book.
To run all the tests in the repository, use the following command:
pytest -s .
Notice: so many test is about trainning a neural network, which may costs a long time. Initially, all tests will fail. As you implement more methods, more tests should pass. This approach ensures that your progress is aligned with the book's content.
To run a specific test, you can use the -k
option to target the desired test. For example:
pytest -s ch02_perceptron/test_perceptron.py -k test_AND
This command runs the test_AND
test in the test_perceptron.py
file located in the ch02_perceptron
directory.
To maintain high code quality and consistency, this repository integrates several tools with pre-commit hooks. You can ignore this part if you don't want to do it.
To set up the pre-commit hooks, run the following command:
pre-commit install
This installs the pre-commit hooks defined in the .pre-commit-config.yaml
file. Once installed, these hooks will automatically check your code for any issues every time you make a commit.
You can also manually run the pre-commit hooks on all files using the following command:
pre-commit run --all-files
This setup helps ensure that your code adheres to defined standards and maintains high quality throughout the development process.
Hope this repo can help you studying the deep learning.