Skip to main content

LightFM recommendation model - Python 3.12+ compatible fork

Project description

LightFM

LightFM logo

Build status
Linux Circle CI
OSX (OpenMP disabled) Travis CI
Windows (OpenMP disabled) Appveyor

Gitter chat PyPI Anaconda-Server Badge

LightFM is a Python implementation of a number of popular recommendation algorithms for both implicit and explicit feedback, including efficient implementation of BPR and WARP ranking losses. It's easy to use, fast (via multithreaded model estimation), and produces high quality results.

It also makes it possible to incorporate both item and user metadata into the traditional matrix factorization algorithms. It represents each user and item as the sum of the latent representations of their features, thus allowing recommendations to generalise to new items (via item features) and to new users (via user features).

For more details, see the Documentation.

Need help? Contact me via email, Twitter, or Gitter.

Installation

Install from pip:

pip install lightfm

or Conda:

conda install -c conda-forge lightfm

Quickstart

Fitting an implicit feedback model on the MovieLens 100k dataset is very easy:

from lightfm import LightFM
from lightfm.datasets import fetch_movielens
from lightfm.evaluation import precision_at_k

# Load the MovieLens 100k dataset. Only five
# star ratings are treated as positive.
data = fetch_movielens(min_rating=5.0)

# Instantiate and train the model
model = LightFM(loss='warp')
model.fit(data['train'], epochs=30, num_threads=2)

# Evaluate the trained model
test_precision = precision_at_k(model, data['test'], k=5).mean()

Articles and tutorials on using LightFM

  1. Learning to Rank Sketchfab Models with LightFM
  2. Metadata Embeddings for User and Item Cold-start Recommendations
  3. Recommendation Systems - Learn Python for Data Science
  4. Using LightFM to Recommend Projects to Consultants

How to cite

Please cite LightFM if it helps your research. You can use the following BibTeX entry:

@inproceedings{DBLP:conf/recsys/Kula15,
  author    = {Maciej Kula},
  editor    = {Toine Bogers and
               Marijn Koolen},
  title     = {Metadata Embeddings for User and Item Cold-start Recommendations},
  booktitle = {Proceedings of the 2nd Workshop on New Trends on Content-Based Recommender
               Systems co-located with 9th {ACM} Conference on Recommender Systems
               (RecSys 2015), Vienna, Austria, September 16-20, 2015.},
  series    = {{CEUR} Workshop Proceedings},
  volume    = {1448},
  pages     = {14--21},
  publisher = {CEUR-WS.org},
  year      = {2015},
  url       = {http://ceur-ws.org/Vol-1448/paper4.pdf},
}

Development

Pull requests are welcome. To install for development:

  1. Clone the repository: git clone git@github.com:lyst/lightfm.git
  2. Setup a virtual environment: cd lightfm && python3 -m venv venv && source ./venv/bin/activate
  3. Install it for development using pip: pip install -e . && pip install -r test-requirements.txt
  4. You can run tests by running ./venv/bin/py.test tests.
  5. LightFM uses black to enforce code formatting and flake8 for linting, see lint-requirements.txt.
  6. [Optional]: You can install pre-commit to locally enfore formatting and linting. Install with:
    pip install pre-commit
    pre-commit install
    

When making changes to the .pyx extension files, you'll need to run python setup.py cythonize in order to produce the extension .c files before running pip install -e ..

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lightfm_next-1.18.6.tar.gz (428.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

lightfm_next-1.18.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

lightfm_next-1.18.6-cp313-cp313-macosx_11_0_arm64.whl (540.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

lightfm_next-1.18.6-cp313-cp313-macosx_10_13_x86_64.whl (544.7 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

lightfm_next-1.18.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

lightfm_next-1.18.6-cp312-cp312-macosx_11_0_arm64.whl (541.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lightfm_next-1.18.6-cp312-cp312-macosx_10_13_x86_64.whl (545.7 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

lightfm_next-1.18.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

lightfm_next-1.18.6-cp311-cp311-macosx_11_0_arm64.whl (540.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lightfm_next-1.18.6-cp311-cp311-macosx_10_9_x86_64.whl (544.3 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

lightfm_next-1.18.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lightfm_next-1.18.6-cp310-cp310-macosx_11_0_arm64.whl (538.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lightfm_next-1.18.6-cp310-cp310-macosx_10_9_x86_64.whl (542.3 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

lightfm_next-1.18.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

lightfm_next-1.18.6-cp39-cp39-macosx_11_0_arm64.whl (539.0 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lightfm_next-1.18.6-cp39-cp39-macosx_10_9_x86_64.whl (542.5 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

lightfm_next-1.18.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

lightfm_next-1.18.6-cp38-cp38-macosx_11_0_arm64.whl (541.1 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lightfm_next-1.18.6-cp38-cp38-macosx_10_9_x86_64.whl (544.7 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file lightfm_next-1.18.6.tar.gz.

File metadata

  • Download URL: lightfm_next-1.18.6.tar.gz
  • Upload date:
  • Size: 428.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for lightfm_next-1.18.6.tar.gz
Algorithm Hash digest
SHA256 988b053da1bad1e7b3aa3d1cefff49643d00b5e5f192fbc834e8d54f6da85000
MD5 3fd55347c0b17b3bb75b734b8a8d1705
BLAKE2b-256 ff0faf80163b2894a4a53c38dffe0a3bafaaf55f20210b9c5bc6c061135c94ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6.tar.gz:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b2ffdab7a6e70f2400f667cdc59e9d83e9f0453434f1bcb20f8d45b770e1518
MD5 5b82681972583a42a150341d0080d8fc
BLAKE2b-256 9b40c557fe9f528dc8bbdf109d7a37d0a940d912e18cac2778f52c8df8b8a7ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 307f0708e395459aa1e40f7092f9be301adc8c392750d5968170d4929db35f0d
MD5 5df064c958430c74b452171c463aaa8d
BLAKE2b-256 2d094698083eeaa7f1044a1a5e42ef1180d68059a73db014dae849b6f237ae21

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 5d000e3b742afc20303696a55af6139f3b7961e22e6c6a627b2108ab4ef780e5
MD5 92e1b4cca17c948cc845154485b0d960
BLAKE2b-256 f7c8d31d9693247355b804740d8338469735cfc5319752c01d70deb9eead4180

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp313-cp313-macosx_10_13_x86_64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d67703c79f30bd0e5b42287fcfa708a1a4e2e92fe080a3f3638c6409923f3961
MD5 33e9f0520bbd5dc6833732788c792325
BLAKE2b-256 c669109d4d1d019d0cc470ad4924cb1756edb8b43d1528f5553af19d16f171bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 83b58e8a8e3b95462f281f438372be4fc6265b5684219f3a97007397beefd17f
MD5 0d97df3503fe4c29b6547e84113c7f03
BLAKE2b-256 5faaf6144e5191e7672f9a6a8e1c1144d08051ccae6f1a2a76452e65ea0b2f27

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 2f09a50d0f67716eb2df992d123b89fe8ab448a593c3bcbc135c1f26b26ab519
MD5 1379a7ea89e7727cbaaf66981b99ab0e
BLAKE2b-256 302f4904c722e89cb76fa3c48e78ae2cead70ec5fd2d2ede0ec67dd738b14704

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp312-cp312-macosx_10_13_x86_64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6d844dbfceff28f5df7f0ecbd63f0c01072c93d7a04f4f515ea051157aefcf6c
MD5 5f06d921d277698ee0aae55f8a3a0304
BLAKE2b-256 8c769ba1e9c2538a40d73fd73678e2997391858a5a7e5d968426dd37b36926a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 061ed5a5c4f5f3a326caef7a7a6d8ee08a674d722cc869177aec7372776f4d88
MD5 5ee66810a57483f3e43b27c0c8e7af6d
BLAKE2b-256 acd906df571d72487fe85f0fe6cf64ec9de331a978a0a72dfbef56764bbe5dfc

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 04bae175dc35bf3bb426b18d2039ee6b0b0753f46a1f97aff791ae11fc91d4e0
MD5 4200690d9b5883d159d54c709dceb333
BLAKE2b-256 aad900b0513d85de7e771e56883485bd1ba07c7dd20c851904854b8513247367

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp311-cp311-macosx_10_9_x86_64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a3f573fefe700db3163294f3b6e453917527c15004742a47bf72e37e51091565
MD5 3732a448c39276bca0c3d44094e1b052
BLAKE2b-256 a6bab250bfbe58ce2154476be69a78a58ca2bd2f8ffcb8eb8fb6ed81c5b9e2dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b3968a36ab5b3bfd6dc55ef7722062c3a6fb477445e7ac387e591e78ddb7e331
MD5 68afbf4fc2537d22a7f4c73568864848
BLAKE2b-256 da2e2ab122151152a1401e9ebf31f4cbb448cafb321b218073256f069b94d792

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 29d5a3bba392e39eec35750b222403d562cbae1af26a778ee4e7ca0d71f3ab85
MD5 a824ac2396b5ec1b3462e883fff1dfb3
BLAKE2b-256 a37a26d01b3de9b8c3982d45906fe066a1fe4a0abd5f962709ed388a162fcb02

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp310-cp310-macosx_10_9_x86_64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c9fafa20010149bbe40090083fcee5b3861447aa5e0c99c3a4ea4da25c9d521f
MD5 61dccebe2e3b9b92858e37cd3b6f431b
BLAKE2b-256 41e014083aac99a582aebac05c73cf036e04f0c46a6e7cfa95f2de5635c5b058

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e90bab3ff108a493948a43da208c11c19b246413bcd42af8f872c00e65508591
MD5 275462afcb1aff7d436de4c84a8f97dc
BLAKE2b-256 93ca47c365347070fc3fc5843231c1492c13a92bb310273b685fe02d529def12

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e8aaf0d30fb851ff9c27f938b3c33ae0561f0fe4077d1be4139ff367c14990c7
MD5 6228595d38e0cd4f070eafada23f306d
BLAKE2b-256 1dc242731dac087d1c5a9a9117ffc7af556a8c5543f4126e905dd0c3ffc5fff3

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp39-cp39-macosx_10_9_x86_64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e8ac39aef3c3d5de2e6bfc87d05ff402fa36d15130e83cecf1bf87cc523c4231
MD5 1b0ad0ac18efb21d45ce48b1971f84e0
BLAKE2b-256 441bd97742dc498d72c820bf86f68a7ae16c92bad503b119a671b1788cdd63b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 285a994d65fba29139c074ce8218423f80f9d80352a8a155e3d086c061689c00
MD5 1e1200e28f8d8e1f3d908a522aa46950
BLAKE2b-256 f40b214dbd4d2502e3c29c0fbb52a35b7ab94b2a0dbf22d1f0769c76bafa8f82

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp38-cp38-macosx_11_0_arm64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightfm_next-1.18.6-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.6-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1fe10771d0170a0be78a72ded5f387c6051a5bc402ef1375420e65c221cee1c0
MD5 97f7e0f05af1d2f0f973c7153d1ffe25
BLAKE2b-256 87f7bd8da87885699a5deda28c7261063503f14802b626edd195cbd6d5e044f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.6-cp38-cp38-macosx_10_9_x86_64.whl:

Publisher: publish.yaml on midodimori/lightfm-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page