{"id":43223304,"url":"https://github.com/gnames/bayes","last_synced_at":"2026-02-01T09:16:03.340Z","repository":{"id":57494026,"uuid":"107587981","full_name":"gnames/bayes","owner":"gnames","description":"A simple implementation of Naive Bayesian classifier","archived":false,"fork":false,"pushed_at":"2025-04-17T21:13:57.000Z","size":69,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-05T00:09:04.981Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gnames.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":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-10-19T19:14:46.000Z","updated_at":"2025-04-17T21:13:54.000Z","dependencies_parsed_at":"2024-12-02T22:18:57.071Z","dependency_job_id":"7ede846f-b71f-499d-bff5-b438d72ffa22","html_url":"https://github.com/gnames/bayes","commit_stats":{"total_commits":30,"total_committers":1,"mean_commits":30.0,"dds":0.0,"last_synced_commit":"102e3525e75c475f14918a755cd02b346229ebe0"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/gnames/bayes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnames%2Fbayes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnames%2Fbayes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnames%2Fbayes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnames%2Fbayes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gnames","download_url":"https://codeload.github.com/gnames/bayes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnames%2Fbayes/sbom","scorecard":{"id":431010,"data":{"date":"2025-08-11","repo":{"name":"github.com/gnames/bayes","commit":"9feeb060ab3c5b396ede599670a7241eb3b242b3"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"Code-Review","score":0,"reason":"Found 0/30 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":"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: 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":"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":"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"}}]},"last_synced_at":"2025-08-19T03:21:02.626Z","repository_id":57494026,"created_at":"2025-08-19T03:21:02.626Z","updated_at":"2025-08-19T03:21:02.626Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28974541,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T08:16:14.655Z","status":"ssl_error","status_checked_at":"2026-02-01T08:06:51.373Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-02-01T09:16:02.873Z","updated_at":"2026-02-01T09:16:03.335Z","avatar_url":"https://github.com/gnames.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bayes [![Build Status][travis-img]][travis] [![Doc Status][doc-img]][doc]\n\n[![DOI](https://zenodo.org/badge/107587981.svg)](https://doi.org/10.5281/zenodo.14262609)\n\nAn implementation of Naive Bayes classifier. More details are in [docs].\n\n## Usage\n\nThis package allows to classify a new entity into one or another category (class)\naccording to features of the entity. The algorithm uses known data to calculate\na weight of each feature for each category.\n\n```go\nfunc Example() {\n\t// there are two jars of cookies, they are our training set.\n\t// Cookies have be round or star-shaped.\n\t// There are plain or chocolate chips cookies.\n\tjar1 := ft.Class(\"Jar1\")\n\tjar2 := ft.Class(\"Jar2\")\n\n\t// Every preclassified feature-set provides data for one cookie. It tells\n\t// what jar has the cookie, what its kind and shape.\n\tcookie1 := ft.ClassFeatures{\n\t\tClass: jar1,\n\t\tFeatures: []ft.Feature{\n\t\t\t{Name: \"kind\", Value: \"plain\"},\n\t\t\t{Name: \"shape\", Value: \"round\"},\n\t\t},\n\t}\n\tcookie2 := ft.ClassFeatures{\n\t\tClass: jar1,\n\t\tFeatures: []ft.Feature{\n\t\t\t{Name: \"kind\", Value: \"plain\"},\n\t\t\t{Name: \"shape\", Value: \"star\"},\n\t\t},\n\t}\n\tcookie3 := ft.ClassFeatures{\n\t\tClass: jar1,\n\t\tFeatures: []ft.Feature{\n\t\t\t{Name: \"kind\", Value: \"chocolate\"},\n\t\t\t{Name: \"shape\", Value: \"star\"},\n\t\t},\n\t}\n\tcookie4 := ft.ClassFeatures{\n\t\tClass: jar1,\n\t\tFeatures: []ft.Feature{\n\t\t\t{Name: \"kind\", Value: \"plain\"},\n\t\t\t{Name: \"shape\", Value: \"round\"},\n\t\t},\n\t}\n\tcookie5 := ft.ClassFeatures{\n\t\tClass: jar1,\n\t\tFeatures: []ft.Feature{\n\t\t\t{Name: \"kind\", Value: \"plain\"},\n\t\t\t{Name: \"shape\", Value: \"round\"},\n\t\t},\n\t}\n\tcookie6 := ft.ClassFeatures{\n\t\tClass: jar2,\n\t\tFeatures: []ft.Feature{\n\t\t\t{Name: \"kind\", Value: \"chocolate\"},\n\t\t\t{Name: \"shape\", Value: \"star\"},\n\t\t},\n\t}\n\tcookie7 := ft.ClassFeatures{\n\t\tClass: jar2,\n\t\tFeatures: []ft.Feature{\n\t\t\t{Name: \"kind\", Value: \"chocolate\"},\n\t\t\t{Name: \"shape\", Value: \"star\"},\n\t\t},\n\t}\n\tcookie8 := ft.ClassFeatures{\n\t\tClass: jar2,\n\t\tFeatures: []ft.Feature{\n\t\t\t{Name: \"kind\", Value: \"chocolate\"},\n\t\t\t{Name: \"shape\", Value: \"star\"},\n\t\t},\n\t}\n\n\tlfs := []ft.ClassFeatures{\n\t\tcookie1, cookie2, cookie3, cookie4, cookie5, cookie6, cookie7, cookie8,\n\t}\n\n\tnb := bayes.New()\n\tnb.Train(lfs)\n\toddsPrior, err := nb.PriorOdds(jar1)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\t// If we got a chocolate star-shaped cookie, which jar it came from most\n\t// likely?\n\taCookie := []ft.Feature{\n\t\t{Name: ft.Name(\"kind\"), Value: ft.Value(\"chocolate\")},\n\t\t{Name: ft.Name(\"shape\"), Value: ft.Value(\"star\")},\n\t}\n\n\tres, err := nb.PosteriorOdds(aCookie)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\t// it is more likely to that a random cookie comes from Jar1, but\n\t// for chocolate and star-shaped cookie it is more likely to come from\n\t// Jar2.\n\tfmt.Printf(\"Prior odds for Jar1 are %0.2f\\n\", oddsPrior)\n\tfmt.Printf(\"The cookie came from %s, with odds %0.2f\\n\", res.MaxClass, res.MaxOdds)\n\t// Output:\n\t// Prior odds for Jar1 are 1.67\n\t// The cookie came from Jar2, with odds 7.50\n}\n```\n\n## Development\n\n### Testing\n\n```bash\ngo test\n```\n\n## Other implementations:\n\n[Go][go-bayes],\n[Java][java-bayes],\n[Python][py-bayes],\n[R][r-bayes],\n[Ruby][ruby-bayes]\n\n[travis-img]: https://travis-ci.org/gnames/bayes.svg?branch=master\n[travis]: https://travis-ci.org/gnames/bayes\n[doc-img]: https://godoc.org/github.com/gnames/bayes?status.png\n[doc]: https://godoc.org/github.com/gnames/bayes\n[BDD]: https://en.wikipedia.org/wiki/Behavior-driven_development\n[ginkgo]: https://github.com/onsi/ginkgo#set-me-up\n[docs]: https://godoc.org/github.com/gnames/bayes\n[r-bayes]: https://CRAN.R-project.org/package=naivebayes\n[py-bayes]: http://www.nltk.org/api/nltk.classify.html#nltk.classify.naivebayes.NaiveBayesClassifier\n[java-bayes]: https://github.com/haifengl/smile/blob/master/core/src/main/java/smile/classification/NaiveBayes.java\n[go-bayes]: https://github.com/cdipaolo/goml/blob/master/text/bayes.go\n[ruby-bayes]: https://github.com/oasic/nbayes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnames%2Fbayes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgnames%2Fbayes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnames%2Fbayes/lists"}