{"id":16335948,"url":"https://github.com/saschagrunert/nn","last_synced_at":"2026-04-07T14:02:37.917Z","repository":{"id":56873758,"uuid":"127754929","full_name":"saschagrunert/nn","owner":"saschagrunert","description":"A tiny neural network 🧠","archived":false,"fork":false,"pushed_at":"2018-05-26T12:07:10.000Z","size":14,"stargazers_count":127,"open_issues_count":0,"forks_count":5,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-02-27T10:59:10.218Z","etag":null,"topics":["backpropagation","backpropagation-algorithm","haskell","haskell-library","machine-learning","neural-network","neural-networks"],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/saschagrunert.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":"2018-04-02T12:44:52.000Z","updated_at":"2024-10-11T12:12:53.000Z","dependencies_parsed_at":"2022-08-20T10:11:09.926Z","dependency_job_id":null,"html_url":"https://github.com/saschagrunert/nn","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saschagrunert%2Fnn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saschagrunert%2Fnn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saschagrunert%2Fnn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saschagrunert%2Fnn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saschagrunert","download_url":"https://codeload.github.com/saschagrunert/nn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243819037,"owners_count":20352807,"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":["backpropagation","backpropagation-algorithm","haskell","haskell-library","machine-learning","neural-network","neural-networks"],"created_at":"2024-10-10T23:42:47.376Z","updated_at":"2026-04-07T14:02:37.910Z","avatar_url":"https://github.com/saschagrunert.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ηn\n## A tiny neural network 🧠\n\nThis small neural network is based on the\n[backpropagation](https://en.wikipedia.org/wiki/Backpropagation) algorithm.\n\n## Usage\n\nA minimal usage example would look like this:\n\n```haskell\nimport AI.Nn (new\n             ,predict\n             ,train)\n\nmain :: IO ()\nmain = do\n  {- Creates a new network with two inputs,\n     two hidden layers and one output -}\n  network \u003c- new [2, 2, 1]\n\n  {- Train the network for a common logical AND,\n     until the maximum error of 0.01 is reached -}\n  let trainedNetwork = train 0.01 network [([0, 0], [0])\n                                          ,([0, 1], [0])\n                                          ,([1, 0], [0])\n                                          ,([1, 1], [1])]\n\n  {- Predict the learned values -}\n  let r00 = predict trainedNetwork [0, 0]\n  let r01 = predict trainedNetwork [0, 1]\n  let r10 = predict trainedNetwork [1, 0]\n  let r11 = predict trainedNetwork [1, 1]\n\n  {- Print the results -}\n  putStrLn $ printf \"0 0 -\u003e %.2f\" (head r00)\n  putStrLn $ printf \"0 1 -\u003e %.2f\" (head r01)\n  putStrLn $ printf \"1 0 -\u003e %.2f\" (head r10)\n  putStrLn $ printf \"1 1 -\u003e %.2f\" (head r11)\n```\n\nThe result should be something like:\n\n```console\n0 0 -\u003e -0.02\n0 1 -\u003e -0.02\n1 0 -\u003e -0.01\n1 1 -\u003e 1.00\n```\n\n## Hacking\nTo start hacking simply clone this repository and make sure that\n[stack](https://docs.haskellstack.org/en/stable/README/) is installed. Then\nsimply hack around and build the project with:\n\n```console\n\u003e stack build --file-watch\n```\n\n## Contributing\nYou want to contribute to this project? Wow, thanks! So please just fork it and\nsend me a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaschagrunert%2Fnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaschagrunert%2Fnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaschagrunert%2Fnn/lists"}