A collection of recommendation algorithms and comparisons
Project description
Cornac
Cornac is python recommender system library for easy, effective and efficient experiments. Cornac is simple and handy. It is designed from the ground-up to faithfully reflect the standard steps taken by researchers to implement and evaluate personalized recommendation models.
Quick Links
Website | Documentation | Preferred.AI
Installation
Currently, we are supporting Python 3 (version 3.6 is recommended). There are several ways to install Cornac:
- From PyPI (you may need a C++ compiler):
pip3 install cornac
- From Anaconda:
conda install cornac -c qttruong -c pytorch
- From the GitHub source (for latest updates):
pip3 install cython
git clone https://github.com/PreferredAI/cornac.git
cd cornac
python3 setup.py install
Note:
Some installed dependencies are CPU versions. If you want to utilize your GPU, you might consider:
- TensorFlow installation instructions.
- PyTorch installation instructions.
- cuDNN (for Nvidia GPUs).
Getting started: your first Cornac experiment
Flow of an Experiment in Cornac
This example will show you how to run your very first experiment.
- Load the MovieLens 100K dataset (will be automatically downloaded if not cached).
from cornac.datasets import MovieLens100K
ml_100k = MovieLens100K.load_data()
- Instantiate an evaluation method. Here we split the data based on ratio.
from cornac.eval_methods import RatioSplit
ratio_split = RatioSplit(data=ml_100k, test_size=0.2, rating_threshold=4.0, exclude_unknowns=False)
- Instantiate models that we want to evaluate. Here we use
Probabilistic Matrix Factorization (PMF)
as an example.
import cornac
pmf = cornac.models.PMF(k=10, max_iter=100, learning_rate=0.001, lamda=0.001)
- Instantiate evaluation metrics.
mae = cornac.metrics.MAE()
rmse = cornac.metrics.RMSE()
rec_20 = cornac.metrics.Recall(k=20)
pre_20 = cornac.metrics.Precision(k=20)
- Instantiate and then run an experiment.
exp = cornac.Experiment(eval_method=ratio_split,
models=[pmf],
metrics=[mae, rmse, rec_20, pre_20],
user_based=True)
exp.run()
Output:
MAE RMSE Recall@20 Precision@20
PMF 0.760277 0.919413 0.081803 0.0462
For more details, please take a look at our examples.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for cornac-0.1.0.post5-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7a0d374d0625e5a5f98aeb32c7e68e657ecbbb2e3ff7f4686d6b1a5b1f16242 |
|
MD5 | edae50a97b547edae4ed4134c2670f04 |
|
BLAKE2b-256 | 2eed7f912ec4c699eebff537e8e8b0d2bf78a2baab94578316bc25cd414b16d5 |
Hashes for cornac-0.1.0.post5-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9528eb8c56e37653d9850ec45d4e275320d8f4609fe2c6206cf20f512fb7f6e1 |
|
MD5 | d24c3426b9e15cd2a3046f06fea4415f |
|
BLAKE2b-256 | bda8c3ede7065974b9ce9290b8d4a504448c4d637ac17dde90dcfe55299a31eb |
Hashes for cornac-0.1.0.post5-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 864acb2991263e3492638e4790098e68f13b6c020738f302064fde590d911b42 |
|
MD5 | 695a63836c5cbd34a2817fa89696bf34 |
|
BLAKE2b-256 | c6eaaf3c1c0266e43934737f47349b0cfc7006745aa22abe447dcf664dd4b1d0 |
Hashes for cornac-0.1.0.post5-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef74d516286e09e7ea1e5e082398dd4aae793665862dce48079520fe90c196a5 |
|
MD5 | 2b6a5518c22a4aca47e030d3b5659a26 |
|
BLAKE2b-256 | 596d32d8e79bfe80ad9950f04a52c0edc7708331f55356a6da1bc335c9d0198f |
Hashes for cornac-0.1.0.post5-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0c3e825b903611b1e41f76f711042467668b325f378781d23f1a4d0b2fb3954 |
|
MD5 | f8befa6976474cd32302eb8ec490b51e |
|
BLAKE2b-256 | d01a7d4a5e8577bf6bd0b134c82ae0577b3fa07e5b7831e5a797898810e25cf8 |
Hashes for cornac-0.1.0.post5-cp35-cp35m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9248363397486e8dc8c15e79121c24032a23dd7092bb3ed162af31cb37e58b32 |
|
MD5 | 1f494eb0d2c9b026b40ccae18410b0fd |
|
BLAKE2b-256 | 25e7984cb269214d8d2863fc31efaf08fe115cb4491de2f1505e65354946df1f |