{"id":13595615,"url":"https://github.com/maciejkula/spotlight","last_synced_at":"2025-05-15T03:08:55.428Z","repository":{"id":37270358,"uuid":"95379459","full_name":"maciejkula/spotlight","owner":"maciejkula","description":"Deep recommender models using PyTorch.","archived":false,"fork":false,"pushed_at":"2022-12-21T23:38:02.000Z","size":9222,"stargazers_count":3013,"open_issues_count":72,"forks_count":422,"subscribers_count":102,"default_branch":"master","last_synced_at":"2025-04-14T03:11:32.447Z","etag":null,"topics":["deep-learning","learning-to-rank","machine-learning","matrix-factorization","python","pytorch","recommender-system"],"latest_commit_sha":null,"homepage":"","language":"Python","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.rst","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":"2017-06-25T18:52:19.000Z","updated_at":"2025-04-10T13:06:11.000Z","dependencies_parsed_at":"2023-01-30T05:01:18.177Z","dependency_job_id":null,"html_url":"https://github.com/maciejkula/spotlight","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejkula%2Fspotlight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejkula%2Fspotlight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejkula%2Fspotlight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejkula%2Fspotlight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maciejkula","download_url":"https://codeload.github.com/maciejkula/spotlight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254264771,"owners_count":22041794,"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","learning-to-rank","machine-learning","matrix-factorization","python","pytorch","recommender-system"],"created_at":"2024-08-01T16:01:53.634Z","updated_at":"2025-05-15T03:08:50.411Z","avatar_url":"https://github.com/maciejkula.png","language":"Python","funding_links":[],"categories":["Recommender Systems","资源列表","5. GitHub Repositories","Python","Pytorch \u0026 related libraries｜Pytorch \u0026 相关库","推荐系统","Pytorch \u0026 related libraries","Recommender Systems [🔝](#readme)","Awesome Python","Deep Learning Tools","Recommendation"],"sub_categories":["推荐系统","Other libraries｜其他库:","Other libraries:","Recommender Systems","Tools"],"readme":".. image:: docs/_static/img/spotlight.png\n\n---------------------------------------------------------------------\n\n.. inclusion-marker-do-not-remove\n\n.. image:: https://travis-ci.org/maciejkula/spotlight.svg?branch=master\n   :target: https://travis-ci.org/maciejkula/spotlight\n\n.. image:: https://ci.appveyor.com/api/projects/status/jq5e76a7a08ra2ji/branch/master?svg=true\n   :target: https://ci.appveyor.com/project/maciejkula/spotlight/branch/master\n\n.. image:: https://badges.gitter.im/gitterHQ/gitter.png\n   :target: https://gitter.im/spotlight-recommendations/Lobby\n\n.. image:: https://anaconda.org/maciejkula/spotlight/badges/version.svg\n   :target: https://anaconda.org/maciejkula/spotlight\n\n.. image:: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat\n   :target: https://maciejkula.github.io/spotlight/\n\n.. image:: https://img.shields.io/badge/progress%20tracker-trello-brightgreen.svg\n   :target: https://trello.com/b/G5iFgS1W/spotlight\n\n|\n\nSpotlight uses `PyTorch \u003chttp://pytorch.org/\u003e`_ to build both deep and shallow\nrecommender models. By providing both a slew of building blocks for loss functions\n(various pointwise and pairwise ranking losses), representations (shallow\nfactorization representations, deep sequence models), and utilities for fetching\n(or generating) recommendation datasets, it aims to be a tool for rapid exploration\nand prototyping of new recommender models.\n\nSee the full `documentation \u003chttps://maciejkula.github.io/spotlight/\u003e`_ for details.\n\nInstallation\n~~~~~~~~~~~~\n\n.. code-block:: python\n\n   conda install -c maciejkula -c pytorch spotlight\n\n\nUsage\n~~~~~\n\nFactorization models\n====================\n\nTo fit an explicit feedback model on the MovieLens dataset:\n\n.. code-block:: python\n\n    from spotlight.cross_validation import random_train_test_split\n    from spotlight.datasets.movielens import get_movielens_dataset\n    from spotlight.evaluation import rmse_score\n    from spotlight.factorization.explicit import ExplicitFactorizationModel\n\n    dataset = get_movielens_dataset(variant='100K')\n\n    train, test = random_train_test_split(dataset)\n\n    model = ExplicitFactorizationModel(n_iter=1)\n    model.fit(train)\n\n    rmse = rmse_score(model, test)\n\n\n\nTo fit an implicit ranking model with a BPR pairwise loss on the MovieLens dataset:\n\n.. code-block:: python\n\n    from spotlight.cross_validation import random_train_test_split\n    from spotlight.datasets.movielens import get_movielens_dataset\n    from spotlight.evaluation import mrr_score\n    from spotlight.factorization.implicit import ImplicitFactorizationModel\n\n    dataset = get_movielens_dataset(variant='100K')\n\n    train, test = random_train_test_split(dataset)\n\n    model = ImplicitFactorizationModel(n_iter=3,\n                                       loss='bpr')\n    model.fit(train)\n\n    mrr = mrr_score(model, test)\n\n\n\n\nSequential models\n=================\n\nRecommendations can be seen as a sequence prediction task: given the items a user\nhas interacted with in the past, what will be the next item they will interact\nwith? Spotlight provides a range of models and utilities for fitting next item\nrecommendation models, including\n\n- pooling models, as in `YouTube recommendations \u003chttps://pdfs.semanticscholar.org/bcdb/4da4a05f0e7bc17d1600f3a91a338cd7ffd3.pdf\u003e`_,\n- LSTM models, as in `Session-based recommendations... \u003chttps://arxiv.org/pdf/1511.06939\u003e`_, and\n- causal convolution models, as in `WaveNet \u003chttps://arxiv.org/pdf/1609.03499\u003e`_.\n\n.. code-block:: python\n\n    from spotlight.cross_validation import user_based_train_test_split\n    from spotlight.datasets.synthetic import generate_sequential\n    from spotlight.evaluation import sequence_mrr_score\n    from spotlight.sequence.implicit import ImplicitSequenceModel\n\n    dataset = generate_sequential(num_users=100,\n                                  num_items=1000,\n                                  num_interactions=10000,\n                                  concentration_parameter=0.01,\n                                  order=3)\n\n    train, test = user_based_train_test_split(dataset)\n\n    train = train.to_sequence()\n    test = test.to_sequence()\n\n    model = ImplicitSequenceModel(n_iter=3,\n                                  representation='cnn',\n                                  loss='bpr')\n    model.fit(train)\n\n    mrr = sequence_mrr_score(model, test)\n\n\n  \n\nDatasets\n========\n\nSpotlight offers a slew of popular datasets, including Movielens 100K, 1M, 10M, and 20M.\nIt also incorporates utilities for creating synthetic datasets. For example, `generate_sequential`\ngenerates a Markov-chain-derived interaction dataset, where the next item a user chooses is\na function of their previous interactions:\n\n.. code-block:: python\n\n    from spotlight.datasets.synthetic import generate_sequential\n\n    # Concentration parameter governs how predictable the chain is;\n    # order determins the order of the Markov chain.\n    dataset = generate_sequential(num_users=100,\n                                  num_items=1000,\n                                  num_interactions=10000,\n                                  concentration_parameter=0.01,\n                                  order=3)\n\n\n\n\nExamples\n~~~~~~~~\n\n1. `Rating prediction on the Movielens dataset \u003chttps://github.com/maciejkula/spotlight/tree/master/examples/movielens_explicit\u003e`_.\n2. `Using causal convolutions for sequence recommendations \u003chttps://github.com/maciejkula/spotlight/tree/master/examples/movielens_sequence\u003e`_.\n3. `Bloom embedding layers \u003chttps://github.com/maciejkula/spotlight/tree/master/examples/bloom_embeddings\u003e`_.\n\n\nHow to cite\n~~~~~~~~~~~\n\nPlease cite Spotlight if it helps your research. You can use the following BibTeX entry:\n\n.. code-block::\n\n   @misc{kula2017spotlight,\n     title={Spotlight},\n     author={Kula, Maciej},\n     year={2017},\n     publisher={GitHub},\n     howpublished={\\url{https://github.com/maciejkula/spotlight}},\n   }\n\n\nContributing\n~~~~~~~~~~~~\n\nSpotlight is meant to be extensible: pull requests are welcome. Development progress is tracked on `Trello \u003chttps://trello.com/b/G5iFgS1W/spotlight\u003e`_: have a look at the outstanding tickets to get an idea of what would be a useful contribution.\n\nWe accept implementations of new recommendation models into the Spotlight model zoo: if you've just published a paper describing your new model, or have an implementation of a model from the literature, make a PR!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaciejkula%2Fspotlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaciejkula%2Fspotlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaciejkula%2Fspotlight/lists"}