{"id":13413361,"url":"https://github.com/dathoangnd/gonet","last_synced_at":"2025-03-14T19:32:01.957Z","repository":{"id":57507038,"uuid":"233277945","full_name":"dathoangnd/gonet","owner":"dathoangnd","description":"Neural Network for Go.","archived":false,"fork":false,"pushed_at":"2020-04-05T16:08:18.000Z","size":22,"stargazers_count":82,"open_issues_count":0,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-07-31T20:52:16.000Z","etag":null,"topics":["deep-learning","go","machine-learning","neural-network"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/dathoangnd/gonet","language":"Go","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/dathoangnd.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":"2020-01-11T18:27:28.000Z","updated_at":"2024-04-13T01:47:22.000Z","dependencies_parsed_at":"2022-08-29T20:32:12.748Z","dependency_job_id":null,"html_url":"https://github.com/dathoangnd/gonet","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/dathoangnd%2Fgonet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dathoangnd%2Fgonet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dathoangnd%2Fgonet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dathoangnd%2Fgonet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dathoangnd","download_url":"https://codeload.github.com/dathoangnd/gonet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243635379,"owners_count":20322928,"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":["deep-learning","go","machine-learning","neural-network"],"created_at":"2024-07-30T20:01:38.595Z","updated_at":"2025-03-14T19:32:01.681Z","avatar_url":"https://github.com/dathoangnd.png","language":"Go","funding_links":[],"categories":["机器学习","Machine Learning","Relational Databases"],"sub_categories":["检索及分析资料库","Advanced Console UIs","Search and Analytic Databases","SQL 查询语句构建库"],"readme":"# gonet\n[![Documentation](https://godoc.org/github.com/dathoangnd/gonet?status.svg)](https://pkg.go.dev/github.com/dathoangnd/gonet)\n[![Go Report Card](https://goreportcard.com/badge/github.com/dathoangnd/gonet)](https://goreportcard.com/report/github.com/dathoangnd/gonet)\n[![CircleCI](https://circleci.com/gh/dathoangnd/gonet.svg?style=svg)](https://circleci.com/gh/dathoangnd/gonet)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)  \n\ngonet is a Go module implementing multi-layer Neural Network.\n\n## Install\nInstall the module with:\n\n```\ngo get github.com/dathoangnd/gonet\n```\nImport it in your project:\n\n```go\nimport \"github.com/dathoangnd/gonet\"\n```\n## Example\nThis example will train a neural network to predict the outputs of XOR logic gates given two binary inputs:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/dathoangnd/gonet\"\n)\n\nfunc main() {\n\t// XOR traning data\n\ttrainingData := [][][]float64{\n\t\t{{0, 0}, {0}},\n\t\t{{0, 1}, {1}},\n\t\t{{1, 0}, {1}},\n\t\t{{1, 1}, {0}},\n\t}\n\n\t// Create a neural network\n\t// 2 nodes in the input layer\n\t// 2 hidden layers with 4 nodes each\n\t// 1 node in the output layer\n\t// The problem is classification, not regression\n\tnn := gonet.New(2, []int{4, 4}, 1, false)\n\n\t// Train the network\n\t// Run for 3000 epochs\n\t// The learning rate is 0.4 and the momentum factor is 0.2\n\t// Enable debug mode to log learning error every 1000 iterations\n\tnn.Train(trainingData, 3000, 0.4, 0.2, true)\n\n\t// Predict\n\ttestInput := []float64{1, 0}\n\tfmt.Printf(\"%f XOR %f =\u003e %f\\n\", testInput[0], testInput[1], nn.Predict(testInput)[0])\n\t// 1.000000 XOR 0.000000 =\u003e 0.943074\n\n\t// Save the model\n\tnn.Save(\"model.json\")\n\n\t// Load the model\n\tnn2, err := gonet.Load(\"model.json\")\n\tif err != nil {\n\t\tlog.Fatal(\"Load model failed.\")\n\t}\n\tfmt.Printf(\"%f XOR %f =\u003e %f\\n\", testInput[0], testInput[1], nn2.Predict(testInput)[0])\n\t// 1.000000 XOR 0.000000 =\u003e 0.943074\n}\n```\n## Documentation\nSee: [https://pkg.go.dev/github.com/dathoangnd/gonet](https://pkg.go.dev/github.com/dathoangnd/gonet)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdathoangnd%2Fgonet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdathoangnd%2Fgonet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdathoangnd%2Fgonet/lists"}