eALS - Element-wise Alternating Least Squares
A Python implementation of the element-wise alternating least squares (eALS) for fast online matrix factorization proposed by arXiv:1708.05024.
Prerequisites
- Python >= 3.8, < 3.11
Installation
pip install eals
Usage
import numpy as np
import scipy.sparse as sps
from eals import ElementwiseAlternatingLeastSquares, load_model
# batch training
user_items = sps.csr_matrix([[1, 2, 0, 0], [0, 3, 1, 0], [0, 4, 0, 4]], dtype=np.float32)
model = ElementwiseAlternatingLeastSquares(factors=2)
model.fit(user_items)
# learned latent vectors
model.user_factors
model.item_factors
# online training for new data (user_id, item_id)
model.update_model(1, 0)
# rating matrix and latent vectors will be expanded for a new user or item
model.update_model(0, 5)
# current rating matrix
model.user_items
# save and load the model
model.save("model.joblib")
model = load_model("model.joblib")
See the examples directory for complete examples.
Development
Setup development environment
git clone https://github.com/newspicks/eals.git
cd eals
poetry run pip install -U pip
poetry install
Tests
poetry run pytest
Set USE_NUMBA=0 for faster testing without numba JIT overhead.
USE_NUMBA=0 poetry run pytest
To run tests against all supported Python versions, use tox.
You may need to add the Python versions in the tox.ini file.
poetry run tox
Metadata
Release files for eals 0.9.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| eals-0.9.6.tar.gz | 8.7 kB | Without provenance | Details for eals-0.9.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eals-0.9.6-py3-none-any.whl | Python 3 | none | any | Details for eals-0.9.6-py3-none-any.whl |
Total release size: 17.2 kB
Release files / eals-0.9.6.tar.gz
| Download URL | eals-0.9.6.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1eccc9571b57529b319c0638cde55588a1c7ebbc7753985aeac535b4cbfec45
|
|
BLAKE2b-256 checksum How to use checksums |
c9e0c2cc2db39a56fd0cc3de909f6ee6898deaa050cf9b3064b727a9554248dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.10.8 Darwin/21.6.0
|
Release files / eals-0.9.6-py3-none-any.whl
| Download URL | eals-0.9.6-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43d0790e5523cb9967287496954c48ef57dd682cfea082befc245422eb5bcc37
|
|
BLAKE2b-256 checksum How to use checksums |
0e9d5917468bc49de2412975a4055f956cf012c0b3d2a7d1998f01123b82812f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.10.8 Darwin/21.6.0
|
Security for eals 0.9.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.