Skip to main content

LightFM recommendation model - Python 3.12+ compatible fork

Project description

LightFM Next

LightFM logo

A Python 3.12+ compatible fork of the original LightFM recommendation library.

Build status
Linux & macOS (3.8-3.12) GitHub Actions

PyPI

Note: This is a community-maintained fork that provides Python 3.12+ compatibility by fixing Cython 3.0+ build issues. All credit goes to the original LightFM authors. If you're using Python < 3.12, consider using the original LightFM package.

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

For Python 3.12+

Install lightfm-next from PyPI:

pip install lightfm-next

Note: Windows support is not available yet. Use Linux or macOS.

For Python < 3.12

Use the original LightFM package:

pip install lightfm

or Conda:

conda install -c conda-forge lightfm

Migration from original LightFM

lightfm-next is a drop-in replacement for the original LightFM. Simply replace your installation:

# Replace this
pip uninstall lightfm
pip install lightfm-next

No code changes required - all imports and APIs remain identical:

from lightfm import LightFM  # Works exactly the same

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 https://github.com/midodimori/lightfm-next.git
  2. Install UV: curl -LsSf https://astral.sh/uv/install.sh | sh
  3. Install dependencies: cd lightfm-next && uv sync --extra dev --extra lint
  4. Run all tests and linting: make test-all

Available make commands:

  • make install - Install dependencies and build extensions
  • make lint - Run flake8 linting
  • make test - Run pytest
  • make test-basic - Run basic functionality test
  • make test-all - Run complete test suite (same as CI)

When making changes to .pyx extension files, run uv run python setup.py build_ext --inplace to rebuild extensions.

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.7.tar.gz (428.2 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.7-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.7-cp313-cp313-macosx_11_0_arm64.whl (551.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

lightfm_next-1.18.7-cp313-cp313-macosx_10_13_x86_64.whl (550.6 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

lightfm_next-1.18.7-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.7-cp312-cp312-macosx_11_0_arm64.whl (552.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lightfm_next-1.18.7-cp312-cp312-macosx_10_13_x86_64.whl (551.8 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

lightfm_next-1.18.7-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.7-cp311-cp311-macosx_11_0_arm64.whl (551.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lightfm_next-1.18.7-cp311-cp311-macosx_10_9_x86_64.whl (550.6 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

lightfm_next-1.18.7-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.7-cp310-cp310-macosx_11_0_arm64.whl (549.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lightfm_next-1.18.7-cp310-cp310-macosx_10_9_x86_64.whl (548.6 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

lightfm_next-1.18.7-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.7-cp39-cp39-macosx_11_0_arm64.whl (549.4 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lightfm_next-1.18.7-cp39-cp39-macosx_10_9_x86_64.whl (548.9 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

lightfm_next-1.18.7-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.7-cp38-cp38-macosx_11_0_arm64.whl (551.3 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lightfm_next-1.18.7-cp38-cp38-macosx_10_9_x86_64.whl (550.8 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: lightfm_next-1.18.7.tar.gz
  • Upload date:
  • Size: 428.2 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.7.tar.gz
Algorithm Hash digest
SHA256 4dc083b16a5248ce28dc7f616810d6b19ea4b40029cb57e741d26d85ec77307f
MD5 d1f0cb646850176f577a1b3e028f9a97
BLAKE2b-256 649b4f6ee9bdb0ac97229dd3fe6541ce6cb642879a01769aa0439f081719e805

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7.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.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5ed724f007f95c41ba87b5804fbaeaa33ab3ca21a948718102bb8a3d464cf262
MD5 a5ec8cf6626cc3c547c1ec20b4ec8995
BLAKE2b-256 49cff4f31ce3184cdd66866d342ade9e47e0a5f22c4082418be1a552cc8070d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 14f8a9f93dfda35ef5d29beab8cee13bb615874a0eae65d78b7508469f889f3e
MD5 0cc349ba7e37f863e6345a9c95018e9d
BLAKE2b-256 6761ff505d5ec56d74e2182eb44478c8f44f80fa1a577db01f3c1fda517870b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 14ca19e7ec64a073b5d3ea70acd84b9721cdb9358fd82da3ae2d5a85c158069c
MD5 e3ad6c89c1b9b9030ddf8c6e466cffd3
BLAKE2b-256 aa8c416702d29610442a78c26f34b0cf86919ec33b82bc14b42fd4a30935f4ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b9d04850f02174c9b153c2e61a72d838995e98301af126e64444c23fd4462910
MD5 1cde69124fb3a80ec53d6b3fef9db246
BLAKE2b-256 af5a0c4eef7b840913fc6bb1e1952232ede099c8361c4db70cc92de0d14f268f

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c4a7e4f41850e10fb94582703bb8a9c128384f7016ed3b2a4283bbeaa4f11757
MD5 371c28e5dad2d113ffce01145f5808d0
BLAKE2b-256 032447fb218536851b925392c72fda308946724981947c2d9ae052c75b791ea0

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f9c9aa63e799dfab1c86fcea0a2b797a43b28f97d46d2045ac0484707ef97047
MD5 966056fdd2f4949c55af2ad93b1ae6cd
BLAKE2b-256 b03ee5f2ab6fc1c41609b04fd585bd61864ed5f513a8830563e8c949a74eef9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1eb6d0c211ca768718149200e692c8f830c4606643a15f848eccf481b9d79baa
MD5 6c2afd1e6fdbabcd491fb27d9cce4ea1
BLAKE2b-256 dd5e81e772e14d09bb8944f3355fb3e017c023368fb6cd0b8b11d641eb740b0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9c741ee8216ef6843bcc159b031cd59a1ba917f29c0d2c9690f6c2136738c40f
MD5 c5dda3b8167a3ea7ac1dde3648a85a62
BLAKE2b-256 8c774827832750b960be1668f581db203edbd51c513593fc3f3c53a29b058051

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 67308e0521a274d2eb19dd7f6521c87026f7d79bef1e95f6daa7e7bc700cf831
MD5 26d24dba19c373478d7498aeae47b48e
BLAKE2b-256 9a278648347189b70bb7b77ee1b0133b086d4efb0fa576b7e7a64b9593faea5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 77b5393f0db473e31aaee5e95ffb2f4e653fb3368968a7943d556f857438645a
MD5 b662078c052f94ca96899a3bae9651da
BLAKE2b-256 09bb2fc32b43ed4c12c5e2b80541e81ae82a61d56e0bb93f33d9bb4dec7202de

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 61c96d9badae423ec6170a028997a1b375eb887309bc2ae1e2e8fa15b1be3e7e
MD5 7ba5c185d11d0701de28f540503536d5
BLAKE2b-256 05d52d0e8c06a210858cb5bab5f376277a23c1e4cde3353da31ad540f230c90e

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e0139c4c34515062ecca2cccc5ae47c1504b319b4a84cae5425dc2d27715bdab
MD5 20d8ec2e023b2fbff813235812beac92
BLAKE2b-256 073a991cd463f022c14f311610528d1288068d389b71c36a077d6a3994514656

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bac070b312b528f46bcf52c6f856726fc1d8117c8e98551cb490b08cc6178a35
MD5 a433c7e21842cbe730558b72e172a4a1
BLAKE2b-256 b34472dd9271235e3d7d8a12b739006b88d8ec61ebd12aa7952af55fa1e5946c

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7024f3e319efef543ea93f3b9e8e0b309ddd9343d73bcf56b77b394d3e759120
MD5 40b59bc6685563c1c93562b1ac34b357
BLAKE2b-256 a576b5a8d3b5f6731bc74ebe8bb7f1d141ec1e2e571e7f1f8d0ccc195e14b273

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 de4dbd7a04ef0e04069a683814ff375e1fcab370e0f2991d3cf6cb3b3ff857af
MD5 2d46bc1defdfacaf04f0974583557fff
BLAKE2b-256 86b5b1ebce419674d0b7a481eab008096700b491d21e0efe65f2fabe81a335cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8a39e05dc2aab5f0961c093064f2795d112fbe228ac4916cde9a05d2aff3aa66
MD5 19181e67695e69dfea3e89fcb0996240
BLAKE2b-256 5aac1116215ad9b4110f6a5be142f20f4175f299efd4c019274c4a75782020b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9d74d1a50f4f7ef04c42b38b130da5c7f20deb1a5efc5a6b68ceb52b1086fdb6
MD5 6effc8565043d7d8d3b2ad80ec8b0933
BLAKE2b-256 6ec03e4d1631d07c55c4b080c750a33032fd52994b33ca7ab0523ea6b8c634b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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.7-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lightfm_next-1.18.7-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 603b7d025ff33d1f7364efd6e52c98f2a352d7d4045b603d587679fe18127236
MD5 95951a42c6e24ec213fdc3cd827dfa67
BLAKE2b-256 6ccec8c0fe7851fe81848a26edff38548161a232bc3eef88b5169f1a4e33517e

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightfm_next-1.18.7-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