_________ _.
.__ |__ |__ | \/ |
|__\__/| | | |
| /
A python implementation of Factorization Machines / Field-aware Factorization Machines with a simple interface.
(FFM fully functioning/tested, FM still not fully tested)
Supports classification and regression.
Project Structure
pyffm
├── engine
│ ├── model
│ │ ├── __init__.py
│ │ ├── base_model.py
│ │ ├── ffm_model.py
│ │ └── fm_model.py
│ ├── __init__.py
│ ├── base_engine.py
│ ├── ffm_engine.py
│ └── fm_engine.py
├── test
│ ├── data
│ │ ├── __init__.py
│ │ ├── bigdata.te.txt
│ │ ├── bigdata.tr.txt
│ │ └── small_sample_train.csv
│ ├── __init__.py
│ ├── test_ctrengine.py
│ ├── test_pyffm.py
│ └── test_utils.py
├── __init__.py
├── pyffm.py
└── util.py
LICENSE
README.md
setup.py
Installation:
pip install pyffm
Basic example:
import pandas as pd
from pyffm import PyFFM
training_params = {'epochs': 2, 'reg_lambda': 0.002}
pyffm = PyFFM(model='ffm', training_params=training_params)
from pyffm.test.data import sample_df # Small training data sample
# Make sure your file has a label column, default name is 'click' but you can either rename it or pass in label=label_column_name
# Balance the dataset so we get some non-zero predictions (very small training sample)
balanced_df = sample_df[sample_df['click'] == 1].append(sample_df[sample_df['click'] == 0].sample(n=1000)).sample(frac=1)
train_data = balanced_df.sample(frac=0.9)
predict_data = balanced_df.drop(train_data.index)
pyffm.train(train_data)
preds = pyffm.predict(predict_data.drop(columns='click'))
Sample data from:
https://github.com/ycjuan/libffm
and:
https://www.kaggle.com/c/criteo-display-ad-challenge
Created using the algorithm described in the original paper:
https://www.csie.ntu.edu.tw/~cjlin/libffm/
Metadata
Release files for pyFFM 0.0.7
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 |
|---|---|---|---|---|
| pyFFM-0.0.7.tar.gz | 11.4 kB | Without provenance | Details for pyFFM-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyFFM-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for pyFFM-0.0.7-py3-none-any.whl |
Total release size: 30.4 kB
Release files / pyFFM-0.0.7.tar.gz
| Download URL | pyFFM-0.0.7.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53debb6a72c7977f9b29ed2bb9b053d48e08fd023cf99038d5afc32dcfb4f3ed
|
|
BLAKE2b-256 checksum How to use checksums |
b01c132ef9f1212b768b5ece043334d8286d8c82e8a8ea3ca63aefd9bf5be201
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.1
|
Release files / pyFFM-0.0.7-py3-none-any.whl
| Download URL | pyFFM-0.0.7-py3-none-any.whl |
|---|---|
| Size | 18.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a352158ef6b15aa6cd4cec232d1503720e4f5ce8a213193890419bdddeca971
|
|
BLAKE2b-256 checksum How to use checksums |
34cf9e2a528b5c95b2288565b4ec939bff13f91c2b127c50de002ebf155f8dad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.1
|
Security for pyFFM 0.0.7
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.