{"id":13574988,"url":"https://github.com/jiwidi/Behavior-Sequence-Transformer-Pytorch","last_synced_at":"2025-04-04T19:30:28.347Z","repository":{"id":41575761,"uuid":"380786162","full_name":"jiwidi/Behavior-Sequence-Transformer-Pytorch","owner":"jiwidi","description":"This is a pytorch implementation for the BST model from Alibaba https://arxiv.org/pdf/1905.06874.pdf","archived":false,"fork":false,"pushed_at":"2022-07-11T14:55:20.000Z","size":229,"stargazers_count":161,"open_issues_count":3,"forks_count":36,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T14:03:44.222Z","etag":null,"topics":["alibaba","behavior","behavior-sequence-transformer","pytorch","recommenders","seq2seq","seq2seq-attn","transformers"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/jiwidi.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":"2021-06-27T16:20:17.000Z","updated_at":"2025-03-26T17:25:29.000Z","dependencies_parsed_at":"2022-07-09T00:16:09.768Z","dependency_job_id":null,"html_url":"https://github.com/jiwidi/Behavior-Sequence-Transformer-Pytorch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiwidi%2FBehavior-Sequence-Transformer-Pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiwidi%2FBehavior-Sequence-Transformer-Pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiwidi%2FBehavior-Sequence-Transformer-Pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiwidi%2FBehavior-Sequence-Transformer-Pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jiwidi","download_url":"https://codeload.github.com/jiwidi/Behavior-Sequence-Transformer-Pytorch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247237606,"owners_count":20906314,"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":["alibaba","behavior","behavior-sequence-transformer","pytorch","recommenders","seq2seq","seq2seq-attn","transformers"],"created_at":"2024-08-01T15:00:57.288Z","updated_at":"2025-04-04T19:30:27.825Z","avatar_url":"https://github.com/jiwidi.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook"],"sub_categories":[],"readme":"# Behavior-Sequence-Transformer-Pytorch\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/jiwidi/Behavior-Sequence-Transformer-Pytorch/blob/master/colab-bst.ipynb)\n\nThis is a pytorch implementation for the BST model from Alibaba https://arxiv.org/pdf/1905.06874.pdf\n\n![](img/bst.png \"BST ARCHITECTURE\")\n\n\nThis model is a novel recommender architecture based on seq2seq models. We translate user behaviour into sequences and predict a rating for each target item (movie).\n# Dataset\nFor this implementation we used Movielens [1M Dataset](https://movielens.org/) that contains timestamps per each rating, making it perfect to test in the sequence recommendation model.\n\n\n# Running\n\nYou can run it in colab [here](https://colab.research.google.com/github/jiwidi/Behavior-Sequence-Transformer-Pytorch/blob/master/colab-bst.ipynb). If you prefer to run locally the model architecture is contained on `pytorch-best.ipynb` while data processing is on the `prepare_data.ipynb` notebook and should be run first.\n\n# Results\nTraining on all-1 user ratings and leaving the latest rating for test we obtain the following results\n\n| Dataset |  MAE  | RMSE |\n| :------ | :---: | ---: |\n| Train   | 0.72  | 0.84 |\n| Test    | 0.74  | 0.93 |\n\nHere is a screenshot of training logs we we see overfitting from epoch 12-15.\n\n![](img/logs.png)\n\n# References\n\n* Original paper [1](https://arxiv.org/pdf/1905.06874.pdf)\n* Keras implementation [2](https://keras.io/examples/structured_data/movielens_recommendations_transformers/)\n* Tensorflow implementation [3](https://github.com/shenweichen/DeepCTR/blob/master/deepctr/models/bst.py)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiwidi%2FBehavior-Sequence-Transformer-Pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjiwidi%2FBehavior-Sequence-Transformer-Pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiwidi%2FBehavior-Sequence-Transformer-Pytorch/lists"}