{"id":22683265,"url":"https://github.com/mtchavez/nnet","last_synced_at":"2025-03-29T14:27:58.257Z","repository":{"id":143221555,"uuid":"10431873","full_name":"mtchavez/nnet","owner":"mtchavez","description":"Neural Net in Go","archived":false,"fork":false,"pushed_at":"2013-06-12T05:28:49.000Z","size":192,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-04T15:32:40.689Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtchavez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-02T03:21:21.000Z","updated_at":"2014-10-17T08:50:17.000Z","dependencies_parsed_at":"2023-03-17T04:50:56.003Z","dependency_job_id":null,"html_url":"https://github.com/mtchavez/nnet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fnnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fnnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fnnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fnnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtchavez","download_url":"https://codeload.github.com/mtchavez/nnet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246195630,"owners_count":20738910,"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-12-09T21:11:25.779Z","updated_at":"2025-03-29T14:27:58.236Z","avatar_url":"https://github.com/mtchavez.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"nnet [![Build Status](https://travis-ci.org/mtchavez/nnet.png)](https://travis-ci.org/mtchavez/nnet)\n====\n\nNeural Net in Go\n\n## Installation\n\nUse ```go get``` to install the package.\n\n```\ngo get -u github.com/mtchavez/nnet/nnet\n```\n\n## Usage\n\nThere are some training examples in ```./nnet/training_sets.go``` to use.\n\nAn example using ```TrainingSet2``` (NAND) would look like this:\n\n```go\npackage main\n\nimport (\n  \"github.com/mtchavez/nnet/nnet\"\n  \"log\"\n  \"math/rand\"\n  \"time\"\n)\n\nfunc init() {\n  rand.Seed(time.Now().UTC().UnixNano())\n}\n\nfunc main() {\n  nn := \u0026nnet.NeuralNet{}\n  nn.SetupNeuralNet(4, 5, 1)\n  nn.Train(nnet.TrainingSet)\n\n  for _, ex := range nnet.TrainingSet {\n    input := ex[:4]\n    expected := ex[4:]\n    output := nn.Predict(input)\n    log.Printf(\"For %+v neural net predicts %+v and we expect %+v\\n\", input, output, expected)\n  }\n}\n```\n\nThe set named ```TrainingSet``` will take a while to run but will finish eventually\nand using the same script above should give you similar output:\n\n```\n2013/06/09 19:08:49 Err:  3.874987320725568e-05\n2013/06/09 19:09:26 Err:  1.6621031811903178e-05\n2013/06/09 19:10:02 Err:  1.0078854035870953e-05\n...\n2013/06/09 19:19:31 Err:  1.1254870026927736e-06\n2013/06/09 19:20:06 Err:  1.0652633938055432e-06\n2013/06/09 19:20:41 Err:  1.0111589283784186e-06\n2013/06/09 19:20:48 For [-0.5 0.75 0.4 0.8] neural net predicts [0.999999715590078] and we expect [1]\n2013/06/09 19:20:48 For [-0.75 0.25 0.3 0.8] neural net predicts [0.0006310811073551809] and we expect [0]\n2013/06/09 19:20:48 For [-0.5 0.75 0.3 0.8] neural net predicts [0.9997530594821283] and we expect [1]\n2013/06/09 19:20:48 For [-0.75 0.5 0.4 0.8] neural net predicts [7.72391221796645e-10] and we expect [0]\n2013/06/09 19:20:48 For [-1 0.25 0.3 0.8] neural net predicts [0.9995155065107615] and we expect [1]\n2013/06/09 19:20:48 For [-0.75 0.5 0.4 0.9] neural net predicts [2.110466190106359e-11] and we expect [0]\n2013/06/09 19:20:48 For [-0.5 0.5 0.3 0.9] neural net predicts [0.00037037185571059725] and we expect [0]\n2013/06/09 19:20:48 For [-0.25 0.5 0.4 0.8] neural net predicts [0.9998935743831123] and we expect [1]\n2013/06/09 19:20:48 For [-0.5 0.75 0.3 0.9] neural net predicts [0.0003226877510435841] and we expect [0]\n2013/06/09 19:20:48 For [-0.25 0.75 0.3 0.9] neural net predicts [0.9999999953574958] and we expect [1]\n2013/06/09 19:20:48 For [-0.5 0.75 0.4 0.8] neural net predicts [0.999999715590078] and we expect [1]\n2013/06/09 19:20:48 For [-0.25 0.75 0.4 0.8] neural net predicts [0.9999998573667516] and we expect [1]\n2013/06/09 19:20:48 For [-1 0.25 0.4 0.8] neural net predicts [1.2870298645547013e-09] and we expect [0]\n2013/06/09 19:20:48 For [-0.5 0.75 0.3 0.8] neural net predicts [0.9997530594821283] and we expect [1]\n2013/06/09 19:20:48 For [-0.5 0.25 0.3 0.8] neural net predicts [0.9992302273315177] and we expect [1]\n2013/06/09 19:20:48 For [-1 0.25 0.3 0.9] neural net predicts [0.9999997050099974] and we expect [1]\n2013/06/09 19:20:48 For [-0.75 0.5 0.4 0.9] neural net predicts [2.110466190106359e-11] and we expect [0]\n2013/06/09 19:20:48 For [-0.25 0.25 0.4 0.9] neural net predicts [0.9999999919841681] and we expect [1]\n2013/06/09 19:20:48 For [-0.25 0.5 0.3 0.8] neural net predicts [0.9997764205767077] and we expect [1]\n2013/06/09 19:20:48 For [-0.5 0.25 0.4 0.9] neural net predicts [0.0005914493975230156] and we expect [0]\n```\n\nWhich shows the NeuralNet has learned the example training set of detemining some outcome given\nbasic information of on a group of people.\n\n## Documentation\n\nDocs are on [Godoc](http://godoc.org/github.com/mtchavez/nnet/nnet)\n\n## Test\n\nYou can run the tests using ```go test```\n\n## TODO\n\n* Allow multiple hidden layers\n* Write function to export weights of neural net\n* Write function to import previously known weights\n* Allow Activation functions to be set to anything\n\n## License\nWritten by Chavez\n\nReleased under the MIT License: http://www.opensource.org/licenses/mit-license.php\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtchavez%2Fnnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtchavez%2Fnnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtchavez%2Fnnet/lists"}