{"id":19227812,"url":"https://github.com/aleksac/nnlib","last_synced_at":"2025-04-21T01:31:49.496Z","repository":{"id":40981768,"uuid":"195283503","full_name":"AleksaC/nnlib","owner":"AleksaC","description":"Simple deep learning library built for educational purposes","archived":false,"fork":false,"pushed_at":"2022-12-08T05:54:26.000Z","size":45,"stargazers_count":5,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-06T03:08:59.808Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/AleksaC.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}},"created_at":"2019-07-04T18:01:53.000Z","updated_at":"2020-02-13T19:31:46.000Z","dependencies_parsed_at":"2023-01-24T14:45:21.656Z","dependency_job_id":null,"html_url":"https://github.com/AleksaC/nnlib","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AleksaC%2Fnnlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AleksaC%2Fnnlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AleksaC%2Fnnlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AleksaC%2Fnnlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AleksaC","download_url":"https://codeload.github.com/AleksaC/nnlib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223844554,"owners_count":17212781,"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","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":"2024-11-09T15:25:27.456Z","updated_at":"2024-11-09T15:25:27.940Z","avatar_url":"https://github.com/AleksaC.png","language":"Python","readme":"# nnlib \n[![license](https://img.shields.io/github/license/AleksaC/nnlib.svg?maxAge=2592000)](https://github.com/AleksaC/nnlib/blob/master/LICENSE)\n[![Build Status](https://travis-ci.com/AleksaC/nnlib.svg?branch=master)](https://travis-ci.com/AleksaC/nnlib)\n[![Coverage Status](https://coveralls.io/repos/github/AleksaC/nnlib/badge.svg?branch=master)](https://coveralls.io/github/AleksaC/nnlib?branch=master)\n\nYou just found nnlib - a minimalistic deep learning library built for\neducational purposes.\n\n## About\n\n### Motivation 🤔\nRichard Feynman once said: *'What I cannot create, I do not understand'* and in\ngeneral I agree with that statement especially when talking about programming.\n\nSo while I was learning deep learning I decided to implement some of the \nalgorithms from scratch in numpy. Since there were a lot of common things\nthat could be shared between implementations of various algorithms I decided to\nuse some of the code I've written to create a small deep learning library with\nan interface similar to Keras.\n\n### Why call it nnlib? 🤷‍♂️ \nIt's a library for building neural nets, hence nnlib... Unfortunately, naming things isn't\nsomething I'm good at.\n\n**Note:** The library is in early alpha version and is undergoing major changes.\nI've been working on it for a long time with huge breaks so coding style and\ndocumentation are inconsistent and I've only started writing tests recently.\nI'm doing my best to clean it up.\n\n## Installation\n\nThe development of the library was done using Python 3.6 but it should work \nfor python 3.4 or higher. It is strongly recommended to use some sort of \nvirtual environment, I prefer plain old virtualenv but you can use pipenv, \nconda environments or anything else you like. To install the dependencies run\n`python -m pip install -r requirements.txt` or simply \n`python -m pip install numpy` as numpy is the only dependency of nnlib. \n\n### Using PyPI\nThe library hasn't been published to PyPI yet so you need to install it from\nsource.\n\n### From source\n```commandline\ngit clone https://github.com/AleksaC/nnlib.git\ncd nnlib\npython -m pip install .\n```\nIf you want to make changes to the library it is best to use\n[editable](https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs)\ninstall by running \n```commandline\npython -m pip install -e .\n```\nThat way all the changes to the code will immediately be reflected in the \ninstalled package.\n\n## Running tests 👩‍🔬\nTo run test you need to have `pytest` installed. To run tests with coverage you\nshould install `pytest-cov` and run `pytest --cov=nnlib tests/`. To run tests\nwithout coverage simpy run `pytest` while being in the root directory of the\nproject.\n\n## Getting started\n\nTo get a taste of nnlib take a look at this simple MLP that achieves 98.25%\ntest accuracy on MNIST classification in around a minute of training on a\nmachine with a decent CPU:\n\n```python\nfrom nnlib.datasets import mnist\nfrom nnlib.core import Model\nfrom nnlib.layers.core import FullyConnected\nfrom nnlib.optimizers import SGD\n\nmodel = Model(\n    FullyConnected(256, activation=\"relu\", input_shape=(784,), weight_initializer=\"he_normal\"),\n    FullyConnected(128, activation=\"relu\", weight_initializer=\"he_normal\"),\n    FullyConnected(10 , weight_initializer=\"xavier_normal\"),\n    loss=\"softmax_crossentropy\",\n    optimizer=SGD(lr=4e-2, decay=2e-4)\n)\n\nmodel.summary()\nmodel.train(*mnist.training_data(flat=True), batch_size=64, epochs=10)\nmodel.test(*mnist.test_data(flat=True), logging_level=1)\n```\n\nFor more examples check out the [examples folder](https://github.com/AleksaC/nnlib/tree/master/examples)\nof this repo.\n\n## Contact 🙋‍♂️\nIf there's anything I can help you with you can find me at my personal [website](https://aleksac.me)\nwhere you can contact me directly or via social media linked there. If you\nliked this project you can follow me on twitter to stay up to date with my\nlatest projects.\n\u003ca target=\"_blank\" href=\"http://twitter.com/aleksa_c_\"\u003e\u003cimg alt='Twitter followers' src=\"https://img.shields.io/twitter/follow/aleksa_c_.svg?style=social\"\u003e\u003c/a\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleksac%2Fnnlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faleksac%2Fnnlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleksac%2Fnnlib/lists"}