Download the PHP package lightfm/lightfm-php without Composer
On this page you can find all versions of the php package lightfm/lightfm-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download lightfm/lightfm-php
More information about lightfm/lightfm-php
Files in lightfm/lightfm-php
Download lightfm/lightfm-php
More information about lightfm/lightfm-php
Files in lightfm/lightfm-php
Vendor lightfm
Package lightfm-php
Short Description PHP port of the LightFM Python library using FFI bindings to C implementation for hybrid recommender systems
License Apache-2.0
Package lightfm-php
Short Description PHP port of the LightFM Python library using FFI bindings to C implementation for hybrid recommender systems
License Apache-2.0
Please rate this library. Is it a good library?
Informations about the package lightfm-php
LightFM PHP
PHP port of the LightFM Python library using FFI bindings to C implementation for hybrid recommender systems.
Installation
Install via Composer:
Requirements
- PHP 8.0 or higher
- FFI extension enabled
- The bundled C library (
liblightfm.so
)
Usage
Running the Examples
The repository includes a comprehensive demo script that showcases all major features of the library.
Prerequisites
-
Install dependencies:
- Ensure the C library is compiled and available:
Run the Demo
Execute the demo script from the project root:
The demo will demonstrate:
- Loading synthetic MovieLens-like data
- Training models with WARP loss function
- Making predictions and generating recommendations
- Evaluating model performance with precision metrics
- Using user and item features
- Working with custom interaction data
Expected Output
The demo will display:
- Dataset statistics (users, items, interactions)
- Training progress and timing
- Model evaluation metrics (precision@5)
- Top recommendations for sample users
- Performance comparison with and without features
- Custom dataset predictions
Note: The current C implementation is simplified, so prediction scores may appear as zeros. This is expected behavior for the initial implementation.
Features
- Hybrid Recommender Systems: Supports both collaborative filtering and content-based filtering
- Multiple Loss Functions: WARP, BPR, and logistic loss functions
- Fast C Implementation: Uses FFI bindings to a compiled C library for performance
- CSR Matrix Support: Efficient sparse matrix operations
- Evaluation Metrics: Built-in precision, recall, and AUC metrics
Classes
LightFM
: Main model class for training and predictionCSRMatrix
: Sparse matrix implementation for efficient data handlingEvaluation
: Evaluation metrics for model performanceMovieLensDataset
: Dataset loader for MovieLens dataLightFMFFI
: FFI bindings to the C library
License
Apache-2.0
All versions of lightfm-php with dependencies
PHP Build Version
Package Version
Requires
php Version
>=8.0
ext-ffi Version *
ext-ffi Version *
The package lightfm/lightfm-php contains the following files
Loading the files please wait ....