{"id":15679614,"url":"https://github.com/ankane/disco-go","last_synced_at":"2026-02-23T21:51:46.059Z","repository":{"id":197304115,"uuid":"698402116","full_name":"ankane/disco-go","owner":"ankane","description":"Recommendations for Go using collaborative filtering","archived":false,"fork":false,"pushed_at":"2025-08-13T09:40:12.000Z","size":66,"stargazers_count":25,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-04T06:01:37.544Z","etag":null,"topics":["recommendation-engine","recommender-system"],"latest_commit_sha":null,"homepage":"","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/ankane.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-09-29T20:45:26.000Z","updated_at":"2025-09-10T06:43:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"8568591c-2531-4fd1-a5b7-9f42ced3cc64","html_url":"https://github.com/ankane/disco-go","commit_stats":null,"previous_names":["ankane/disco-go"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ankane/disco-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fdisco-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fdisco-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fdisco-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fdisco-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankane","download_url":"https://codeload.github.com/ankane/disco-go/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fdisco-go/sbom","scorecard":{"id":197145,"data":{"date":"2025-08-11","repo":{"name":"github.com/ankane/disco-go","commit":"88b1ff9b34cd83c605071abc65667d4e813e5e38"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.4,"checks":[{"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":"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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"Maintained","score":10,"reason":"20 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","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":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Info: no jobLevel write permissions found"],"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/ankane/disco-go/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/ankane/disco-go/build.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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-16T22:01:02.711Z","repository_id":197304115,"created_at":"2025-08-16T22:01:02.712Z","updated_at":"2025-08-16T22:01:02.712Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284894825,"owners_count":27080777,"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","status":"online","status_checked_at":"2025-11-17T02:00:06.431Z","response_time":55,"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":["recommendation-engine","recommender-system"],"created_at":"2024-10-03T16:33:40.009Z","updated_at":"2025-11-17T14:18:11.841Z","avatar_url":"https://github.com/ankane.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Disco Go\n\n:fire: Recommendations for Go using collaborative filtering\n\n- Supports user-based and item-based recommendations\n- Works with explicit and implicit feedback\n- Uses high-performance matrix factorization\n\n[![Build Status](https://github.com/ankane/disco-go/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/disco-go/actions)\n\n## Installation\n\nRun:\n\n```sh\ngo get github.com/ankane/disco-go\n```\n\n## Getting Started\n\nImport the package\n\n```go\nimport \"github.com/ankane/disco-go\"\n```\n\nPrep your data in the format `userId, itemId, value`\n\n```go\ndata := disco.NewDataset[string, string]()\ndata.Push(\"user_a\", \"item_a\", 5.0)\ndata.Push(\"user_a\", \"item_b\", 3.5)\ndata.Push(\"user_b\", \"item_a\", 4.0)\n```\n\nIDs can be integers or strings\n\n```go\ndata.Push(1, \"item_a\", 5.0)\n```\n\nIf users rate items directly, this is known as explicit feedback. Fit the recommender with:\n\n```go\nrecommender, err := disco.FitExplicit(data)\n```\n\nIf users don’t rate items directly (for instance, they’re purchasing items or reading posts), this is known as implicit feedback. Use `1.0` or a value like number of purchases or page views for the dataset, and fit the recommender with:\n\n```go\nrecommender, err := disco.FitImplicit(data)\n```\n\nGet user-based recommendations - “users like you also liked”\n\n```go\nrecommender.UserRecs(userId, 5)\n```\n\nGet item-based recommendations - “users who liked this item also liked”\n\n```go\nrecommender.ItemRecs(itemId, 5)\n```\n\nGet the predicted rating for a specific user and item\n\n```go\nrecommender.Predict(userId, itemId)\n```\n\nGet similar users\n\n```go\nrecommender.SimilarUsers(userId, 5)\n```\n\n## Examples\n\n### MovieLens\n\nLoad the data\n\n```go\ndata, err := disco.LoadMovieLens()\n```\n\nCreate a recommender\n\n```go\nrecommender, err := disco.FitExplicit(data, disco.Factors(20))\n```\n\nGet similar movies\n\n```go\nrecommender.ItemRecs(\"Star Wars (1977)\", 5)\n```\n\n## Storing Recommendations\n\nSave recommendations to your database.\n\nAlternatively, you can store only the factors and use a library like [pgvector-go](https://github.com/pgvector/pgvector-go). See an [example](https://github.com/pgvector/pgvector-go/blob/master/examples/disco/main.go).\n\n## Algorithms\n\nDisco uses high-performance matrix factorization.\n\n- For explicit feedback, it uses the [stochastic gradient method with twin learners](https://www.csie.ntu.edu.tw/~cjlin/papers/libmf/mf_adaptive_pakdd.pdf)\n- For implicit feedback, it uses the [conjugate gradient method](https://www.benfrederickson.com/fast-implicit-matrix-factorization/)\n\nSpecify the number of factors and iterations\n\n```go\nrecommender, err := disco.FitExplicit(data, disco.Factors(8), disco.Iterations(20))\n```\n\n## Progress\n\nPass a callback to show progress\n\n```go\ncallback := func(info disco.FitInfo) { fmt.Printf(\"%+v\\n\", info) }\nrecommender, err := disco.FitExplicit(data, disco.Callback(callback))\n```\n\nNote: `TrainLoss` and `ValidLoss` are not available for implicit feedback\n\n## Validation\n\nPass a validation set with explicit feedback\n\n```go\nrecommender, err := disco.FitEvalExplicit(trainSet, validSet)\n```\n\nThe loss function is RMSE\n\n## Cold Start\n\nCollaborative filtering suffers from the [cold start problem](https://en.wikipedia.org/wiki/Cold_start_(recommender_systems)). It’s unable to make good recommendations without data on a user or item, which is problematic for new users and items.\n\n```go\nrecommender.UserRecs(newUserId, 5) // returns empty array\n```\n\nThere are a number of ways to deal with this, but here are some common ones:\n\n- For user-based recommendations, show new users the most popular items\n- For item-based recommendations, make content-based recommendations\n\n## Reference\n\nGet ids\n\n```go\nrecommender.UserIds()\nrecommender.ItemIds()\n```\n\nGet the global mean\n\n```go\nrecommender.GlobalMean()\n```\n\nGet factors\n\n```go\nrecommender.UserFactors(userId)\nrecommender.ItemFactors(itemId)\n```\n\n## References\n\n- [A Learning-rate Schedule for Stochastic Gradient Methods to Matrix Factorization](https://www.csie.ntu.edu.tw/~cjlin/papers/libmf/mf_adaptive_pakdd.pdf)\n- [Faster Implicit Matrix Factorization](https://www.benfrederickson.com/fast-implicit-matrix-factorization/)\n\n## History\n\nView the [changelog](https://github.com/ankane/disco-go/blob/master/CHANGELOG.md)\n\n## Contributing\n\nEveryone is encouraged to help improve this project. Here are a few ways you can help:\n\n- [Report bugs](https://github.com/ankane/disco-go/issues)\n- Fix bugs and [submit pull requests](https://github.com/ankane/disco-go/pulls)\n- Write, clarify, or fix documentation\n- Suggest or add new features\n\nTo get started with development:\n\n```sh\ngit clone https://github.com/ankane/disco-go.git\ncd disco-go\ngo mod tidy\ngo test -v\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankane%2Fdisco-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankane%2Fdisco-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankane%2Fdisco-go/lists"}