{"id":16885598,"url":"https://github.com/maciejkula/sbr-go","last_synced_at":"2025-03-17T06:31:36.386Z","repository":{"id":57492544,"uuid":"134605044","full_name":"maciejkula/sbr-go","owner":"maciejkula","description":"Recommender systems for Go","archived":false,"fork":false,"pushed_at":"2018-06-28T12:59:57.000Z","size":909,"stargazers_count":173,"open_issues_count":1,"forks_count":17,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-02-27T19:03:42.248Z","etag":null,"topics":["deep-learning","golang","machine-learning","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/maciejkula.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":"2018-05-23T17:37:48.000Z","updated_at":"2024-09-22T17:05:28.000Z","dependencies_parsed_at":"2022-08-28T11:51:39.935Z","dependency_job_id":null,"html_url":"https://github.com/maciejkula/sbr-go","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejkula%2Fsbr-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejkula%2Fsbr-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejkula%2Fsbr-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejkula%2Fsbr-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maciejkula","download_url":"https://codeload.github.com/maciejkula/sbr-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243847062,"owners_count":20357317,"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","golang","machine-learning","recommender-system"],"created_at":"2024-10-13T16:36:03.262Z","updated_at":"2025-03-17T06:31:35.965Z","avatar_url":"https://github.com/maciejkula.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sbr-go\n[![Build Status](https://travis-ci.org/maciejkula/sbr-go.svg?branch=master)](https://travis-ci.org/maciejkula/sbr-go)\n[![Godoc](https://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square)](https://godoc.org/github.com/maciejkula/sbr-go)\n\nA recommender system package for Go.\n\nSbr implements state-of-the-art sequence-based models, using the history of what a user has liked to suggest new items. As a result, it makes accurate predictions that can be updated in real-time in response to user actions without model re-training.\n\nSbr implements cutting-edge sequence-based recommenders: for every user, we examine what\nthey have interacted up to now to predict what they are going to consume next.\n\nImplemented models:\n- LSTM: a model that uses an LSTM network over the sequence of a user's interaction\n        to predict their next action;\n- EWMA: a model that uses a simpler exponentially-weighted average of past actions\n        to predict future interactions.\n\nWhich model performs the best will depend on your dataset. The EWMA model is much\nquicker to fit, and will probably be a good starting point.\n\n## Usage\nYou can fit a model on the Movielens 100K dataset in about 10 seconds using the following code:\n```go\n\t// Load the data.\n\tdata, err := sbr.GetMovielens()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"Loaded movielens data: %v users and %v items for a total of %v interactions\\n\",\n\t\tdata.NumUsers(), data.NumItems(), data.Len())\n\n\t// Split into test and train.\n\trng := rand.New(rand.NewSource(42))\n\ttrain, test := sbr.TrainTestSplit(data, 0.2, rng)\n\tfmt.Printf(\"Train len %v, test len %v\\n\", train.Len(), test.Len())\n\n\t// Instantiate the model.\n\tmodel := sbr.NewImplicitLSTMModel(train.NumItems())\n\n\t// Set the hyperparameters.\n\tmodel.ItemEmbeddingDim = 32\n\tmodel.LearningRate = 0.16\n\tmodel.L2Penalty = 0.0004\n\tmodel.NumEpochs = 10\n\tmodel.NumThreads = 1\n\n\t// Set random seed\n\tvar randomSeed [16]byte\n\tfor idx := range randomSeed {\n\t\trandomSeed[idx] = 42\n\t}\n\tmodel.RandomSeed = randomSeed\n\n\t// Fit the model.\n\tfmt.Printf(\"Fitting the model...\\n\")\n\tloss, err := model.Fit(\u0026train)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// And evaluate.\n\tfmt.Printf(\"Evaluating the model...\\n\")\n\tmrr, err := model.MRRScore(\u0026test)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"Loss %v, MRR: %v\\n\", loss, mrr)\n```\n## Installation\nRun\n```\ngo get github.com/maciejkula/sbr-go\n```\nfollowed by\n```\nmake\n```\nin the installation directory. This will download the package's native dependencies. On both OSX and Linux, the resulting binaries are fully statically linked, and you can deploy them like any other Go binary.\n\nIf you prefer to build the dependencies from source, run `make source` instead.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaciejkula%2Fsbr-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaciejkula%2Fsbr-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaciejkula%2Fsbr-go/lists"}