{"id":13564329,"url":"https://github.com/breskos/gopher-learn","last_synced_at":"2026-02-07T03:03:28.635Z","repository":{"id":49963908,"uuid":"272198148","full_name":"breskos/gopher-learn","owner":"breskos","description":"Golang neural network - fast and easy classification and regression.","archived":false,"fork":false,"pushed_at":"2021-06-07T18:02:37.000Z","size":401,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T21:35:18.611Z","etag":null,"topics":["analysis","classification","machine-learning","neural-network","online-learning"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/breskos.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-06-14T12:30:58.000Z","updated_at":"2024-06-27T13:49:15.000Z","dependencies_parsed_at":"2022-09-26T18:31:28.255Z","dependency_job_id":null,"html_url":"https://github.com/breskos/gopher-learn","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/breskos/gopher-learn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breskos%2Fgopher-learn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breskos%2Fgopher-learn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breskos%2Fgopher-learn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breskos%2Fgopher-learn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/breskos","download_url":"https://codeload.github.com/breskos/gopher-learn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breskos%2Fgopher-learn/sbom","scorecard":{"id":252442,"data":{"date":"2025-08-11","repo":{"name":"github.com/breskos/gopher-learn","commit":"3ecb6dd34032923246f34ab9d7bf963d21b7d715"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/4 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU General Public License v3.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T08:49:56.140Z","repository_id":49963908,"created_at":"2025-08-17T08:49:56.141Z","updated_at":"2025-08-17T08:49:56.141Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29185116,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T00:44:15.062Z","status":"online","status_checked_at":"2026-02-07T02:00:07.217Z","response_time":63,"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":["analysis","classification","machine-learning","neural-network","online-learning"],"created_at":"2024-08-01T13:01:29.773Z","updated_at":"2026-02-07T03:03:28.620Z","avatar_url":"https://github.com/breskos.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# gopher-learn\n\n![gopher-learn-logo](http://alexander.bre.sk/x/gopher-neural-small.png \" The Gopher Neural logo \")\n\n## Quickstart\n\n- See examples here: https://github.com/breskos/gopher-learn/tree/master/examples\n\n## What is gopher-learn?\n\n- Artificial neural network written in Golang with training / testing framework\n- Rich measurement mechanisms to control the training\n- Examples for fast understanding\n- Can also be used for iterative online learning (using online module) for autonomous agents\n- Encoders can be used to encoder string data or massive float slices\n\n## Install\n\n```\n  go get github.com/breskos/gopher-learn/...\n```\n\n## Examples\n\nFind the examples in the examples folder.\nAll the data to run the examples [can be found here](https://github.com/breskos/gopher-learn-data).\n\n## The gopher-learn engine\n\nThe engine helps you with optimizing the learning process.\nBasically it starts with a high learning rate to make fast progress in the beginning.\nAfter some rounds of learning (epochs) the learning rate declines (decay).\nDuring the process the best network is saved.\nAfter engine finished training you receive the ready to go network.\n\n## Modes\n\nGopher-neural can be used to perform classification and regression. This sections helps to set up both modes. In general, you have to take care about the differences between both modes during these parts: read training data from file, start engine, use evaluation modes and perform in production.\n\n### Classification\n\n#### Read training data from file\n\n```go\ndata := learn.NewSet(neural.Classification)\nok, err := data.LoadFromCSV(dataFile)\n```\n\n#### Start engine\n\nThis uses the standard config of the engine.\nFor finetuning use e.SetConfig() to set your own config.\n\n```go\ne := engine.NewEngine(neural.Classification, []int{hiddenNeurons}, data)\ne.SetVerbose(true)\ne.Start(neural.Distance)\n```\n\n#### Use evalation mode\n\n```go\nevaluation.PrintSummary(\"name of class1\")\nevaluation.PrintSummary(\"name of class2\")\nevaluation.PrintConfusionMatrix()\n```\n\n#### Perform in production\n\n```go\nx := net.CalculateWinnerLabel(vector)\n```\n\n### Regression\n\nImportant note: Use regression just with a target value between 0 and 1.\n\n#### Read training data from file\n\n```go\ndata := learn.NewSet(neural.Regression)\nok, err := data.LoadFromCSV(dataFile)\n```\n\n#### Start engine\n\nThis uses the standard config of the engine.\nFor finetuning use e.SetConfig() to set your own config.\n\n```go\ne := engine.NewEngine(neural.Regression, []int{hiddenNeurons}, data)\ne.SetVerbose(true)\ne.Start(neural.Distance)\n```\n\n#### Use evalation mode\n\n```go\nevaluation.GetRegressionSummary()\n```\n\n#### Perform in production\n\n```go\nx := net.Calculate(vector)\n```\n\n## Criterions\n\nTo let the engine decide for the best model, a few criterias were implemented. They are listed below together with a short regarding their application:\n\n- **Accuracy** - uses simple accuracy calculation to decide the best model. Not suitable with unbalanced data sets.\n- **BalancedAccuracy** - uses balanced accuracy. Suitable for unbalanced data sets.\n- **FMeasure** - uses F1 score. Suitable for unbalanced data sets.\n- **Simple** - uses simple correct classified divided by all classified samples. Suitable for regression with thresholding.\n- **Distance** - uses distance between ideal output and current output. Suitable for regression.\n\n```go\n...\ne := engine.NewEngine(neural.Classification, []int{100}, data)\ne.Start(neural.Distance, tries, epochs, trainingSplit, learningRate, decay)\n...\n```\n\n## Some more basics\n\n### Train a network using engine\n\nUsing the engine makes sense for you if you want to fully use the training framework that gopher-learn offers you.\nWith engine package the network is learned using learning rate, decay, epochs.\nAlso in the engine you can choose between the criteria options to find the best network.\n\n```go\nimport (\n\t\"fmt\"\n\n\t\"github.com/breskos/gopher-learn\"\n\t\"github.com/breskos/gopher-learn/engine\"\n\t\"github.com/breskos/gopher-learn/learn\"\n\t\"github.com/breskos/gopher-learn/persist\"\n)\n\nconst (\n\tdataFile      = \"data.csv\"\n\tnetworkFile   = \"network.json\"\n\ttries         = 1\n\tepochs        = 100\n\ttrainingSplit = 0.7\n\tlearningRate  = 0.6\n\tdecay         = 0.005\n  hiddenNeurons = 20\n)\n\nfunc main() {\n\tdata := learn.NewSet(neural.Classification)\n\tok, err := data.LoadFromCSV(dataFile)\n\tif !ok || nil != err {\n\t\tfmt.Printf(\"something went wrong -\u003e %v\", err)\n\t}\n\te := engine.NewEngine(neural.Classification, []int{hiddenNeurons}, data)\n\te.SetVerbose(true)\n\te.SetConfig(\u0026engine.Config{\n\t\tTries:               tries,\n\t\tEpochs:              epochs,\n\t\tTrainingSplit:       trainingSplit,\n\t\tLearningRate:        learningRate,\n\t\tDecay:               decay,\n\t})\n\te.Start(neural.Distance)\n\tnetwork, evaluation := e.GetWinner()\n\n\tevaluation.PrintSummary(\"name of class1\")\n\tevaluation.PrintSummary(\"name of class2\")\n\n\terr = persist.ToFile(networkFile, network)\n\tif err != nil {\n\t\tfmt.Printf(\"error while saving network: %v\\n\", err)\n\t}\n\tnetwork2, err := persist.FromFile(networkFile)\n\tif err != nil {\n\t\tfmt.Printf(\"error while loading network: %v\\n\", err)\n\t}\n  // check the network with the first sample\n\tw := network2.CalculateWinnerLabel(data.Samples[0].Vector)\n\tfmt.Printf(\"%v -\u003e %v\\n\", data.Samples[0].Label, w)\n\n  fmt.Println(\" * Confusion Matrix *\")\n\tevaluation.PrintConfusionMatrix()\n}\n\n```\n\n### Create simple network for classification\n\n```go\n\n  import \"github.com/breskos/gopher-learn/net\"\n  // Network has 9 enters and 3 layers\n  // ( 9 neurons, 9 neurons and 2 neurons).\n  // Last layer is network output (2 neurons).\n  // For these last neurons we need labels (like: spam, nospam, positive, negative)\n  labels := make(map[int]string)\n  labels[0] = \"positive\"\n  labels[1] = \"negative\"\n  n := net.NewNetwork(9, []int{9,9,2}, map[int])\n  // Randomize sypaseses weights\n  n.RandomizeSynapses()\n\n  // now you can calculate on this network (of course it is not trained yet)\n  // (for the training you can use then engine)\n  result := n.Calculate([]float64{0,1,0,1,1,1,0,1,0})\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbreskos%2Fgopher-learn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbreskos%2Fgopher-learn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbreskos%2Fgopher-learn/lists"}