{"id":31805595,"url":"https://github.com/st235/make-your-own-neural-network","last_synced_at":"2025-10-11T02:55:24.772Z","repository":{"id":316321977,"uuid":"1061195036","full_name":"st235/Make-Your-Own-Neural-Network","owner":"st235","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-23T22:24:00.000Z","size":243,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-24T00:18:31.917Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/st235.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-21T12:43:50.000Z","updated_at":"2025-09-23T22:24:04.000Z","dependencies_parsed_at":"2025-09-29T18:17:33.004Z","dependency_job_id":null,"html_url":"https://github.com/st235/Make-Your-Own-Neural-Network","commit_stats":null,"previous_names":["st235/make-your-own-neural-network"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/st235/Make-Your-Own-Neural-Network","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/st235%2FMake-Your-Own-Neural-Network","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/st235%2FMake-Your-Own-Neural-Network/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/st235%2FMake-Your-Own-Neural-Network/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/st235%2FMake-Your-Own-Neural-Network/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/st235","download_url":"https://codeload.github.com/st235/Make-Your-Own-Neural-Network/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/st235%2FMake-Your-Own-Neural-Network/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005954,"owners_count":26084009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-11T02:55:23.383Z","updated_at":"2025-10-11T02:55:24.765Z","avatar_url":"https://github.com/st235.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Make Your Own Neural Network\n\nThis repository contains a from-scratch implementation of a simple neural network.\n\n\u003cimg src=\"./resources/book.png\" width=\"150\" /\u003e\n\nThe design is inspired by Tariq Rashid’s book *Make Your Own Neural Network*, but it extends beyond the material covered there.\n\n## Implementation\n\n### Modules\n\nThe network is built using a few common layers/blocks:\n\n* Linear (Weights)\n* ReLU\n* Sigmoid\n* Softmax\n\nEach layer supports both forward propagation and backpropagation (derivatives).\n\nHere’s a diagram of the components:\n\n![Modules diagram](./resources/modules_diagram.png)\n\n### Weight Initialization\n\nThe linear layers can be initialized using different heuristics. Two popular ones are included:\n\n* Normalized Xavier\n* He\n\n### Neural Network\n\nAll of these components are wrapped under a single class called **NeuralNetwork**.\nIt lets you choose:\n\n* an activation function (ReLU or Sigmoid)\n* a weight initialization method\n\nThe network architecture works as follows:\n\n1. `len(hidden_layers)` fully connected linear blocks, each followed by an activation function\n2. A final Softmax block\n\nThe class provides methods for both training (backward pass) and inference (forward pass).\n\n## Experiments\n\nThe model was trained on the [MNIST dataset](https://en.wikipedia.org/wiki/MNIST_database) and reached **90%+** accuracy on the test set.\n\n![MNIST results](./resources/mnist.png)\n\nIt was also tested on custom handwritten digits, where accuracy was noticeably lower:\n\n![Custom results](./resources/custom.png)\n\nThis difference likely comes from variations between the custom images and the original dataset.\n\n\u003e [!TIP]\n\u003e More details can be found in the [`Demo` notebook](./Demo.ipynb).\n\n## Further Work\n\nThe implemented model successfully learns patterns and produces solid results, even with a relatively simple dataset.\n\nSome possible directions for further exploration include:\n\n* Addressing vanishing and exploding gradients\n  * Applying gradient clipping\n  * Using gradient scaling\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fst235%2Fmake-your-own-neural-network","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fst235%2Fmake-your-own-neural-network","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fst235%2Fmake-your-own-neural-network/lists"}