Skip to main content

A simple recommendation system using LightFM

Project description

Easy Recommender

English | 日本語

⚠️ This package is currently broken and under repair. Please do not use. ⚠️

This project only works with Python 3.11.11 because LightFM requires this specific version. Other versions are not supported.

A simple and efficient recommendation system library using LightFM.

Features

  • Simple API for building recommendation systems
  • Support for both implicit and explicit feedback
  • Built on top of proven library (LightFM)
  • Easy data preprocessing utilities

Installation

pip install easy-recommender

Quick Start

from easy_recommender import recommend, process_df, build_feature_data
import pandas as pd

# Load your data
df = pd.read_csv('your_ratings.csv')

user_features = ['gender', 'age']
item_features = ['price', 'genre']

# Get recommendations
recommendations = recommend(
    processed_df, 
    user_features, 
    item_features,
)

print(recommendations)

Higher values indicate items that are more recommended.

If you want to recommend users for items instead, please swap the user and item columns.

Data Requirements

This library takes user behavior log CSV as an argument. Behavior logs are records of users purchasing/viewing/liking item A.

Specifically, to use this library, you need CSV data in the following format:

  • CSV with headers: Must include column names
  • Required columns: user_id and item_id must be present
  • Feature columns:
    • User-related column names should be specified as user_features (list of strings)
    • Item-related column names should be specified as item_features (list of strings)
    • If you have columns that don't belong to either users or items, include them in user_features
  • Data quality: Columns with many null or undefined values may affect recommendation accuracy. Please remove such columns in advance.

Data Example

For example, the following data format is expected. Note that case sensitivity matters. Also, there is no automatic conversion between numeric and string types. If you write rankings as "1", it's treated as a string. If categories are handled as numbers like 2,3, they are treated as numeric values, which may reduce recommendation accuracy.

user_id,item_id,gender,age,price,genre
1,101,M,25,1200,Action
1,102,M,25,800,Comedy
2,101,F,30,1200,Action

Requirements

  • Python =3.11.11

License

MIT License

References

This implementation is based on the approach described in: https://zenn.dev/genda_jp/articles/2c2a1b5d185741

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

easy_recommender-0.1.3.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

easy_recommender-0.1.3-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file easy_recommender-0.1.3.tar.gz.

File metadata

  • Download URL: easy_recommender-0.1.3.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for easy_recommender-0.1.3.tar.gz
Algorithm Hash digest
SHA256 62ad74c1683ad58be787e4f8832796ad3036fce202fdddb3b5ad513df20affc2
MD5 e2707553b5dcbdb9dccc6acd6b0116a7
BLAKE2b-256 53d9c4998987511120e8fef87456656e5462033bcddfc3ea28a2097b11e803c5

See more details on using hashes here.

File details

Details for the file easy_recommender-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for easy_recommender-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2129d3856f1331c85194913feb99e64e05e725d7f8f1cc3fecf8810a5672a9d8
MD5 74ecfa33a4a758abc0c05fcd2084bedb
BLAKE2b-256 0c2f91b856873f46171bb84900818923109b66c65a7dde0b7e10508e4f84766a

See more details on using hashes here.

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