lightfm
1.17
建置狀態 | |
---|---|
Linux | |
OSX(停用 OpenMP) | |
Windows(停用 OpenMP) |
LightFM 是許多流行的隱式和明確回饋推薦演算法的 Python 實現,包括 BPR 和 WARP 排名損失的高效實現。它易於使用,速度快(透過多線程模型估計),並產生高品質的結果。
它也使得將項目和用戶元資料合併到傳統的矩陣分解演算法中成為可能。它將每個用戶和項目表示為其特徵的潛在表示的總和,從而允許推薦泛化到新項目(透過項目特徵)和新用戶(透過用戶特徵)。
有關更多詳細信息,請參閱文件。
需要幫助嗎?透過電子郵件、Twitter 或 Gitter 與我聯繫。
從pip
安裝:
pip install lightfm
或康達:
conda install -c conda-forge lightfm
在 MovieLens 100k 資料集上擬合隱式回饋模型非常簡單:
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 ()
如果 LightFM 對您的研究有幫助,請引用它。您可以使用以下 BibTeX 條目:
@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},
}
歡迎請求請求。安裝用於開發:
git clone [email protected]:lyst/lightfm.git
cd lightfm && python3 -m venv venv && source ./venv/bin/activate
pip install -e . && pip install -r test-requirements.txt
./venv/bin/py.test tests
來執行測試。lint-requirements.txt
。pip install pre-commit
pre-commit install
更改.pyx
擴充檔時,您需要執行python setup.py cythonize
以便在執行pip install -e .
之前產生擴充功能.c
檔。 。