Registry / ai-ml / cornac

cornac

JSON →
library2.5.0pypypi✓ verified 85d ago

Cornac is a comparative framework for multimodal recommender systems, providing a rich set of algorithms and evaluation metrics. Version 2.5.0 requires Python >= 3.10. Released under Apache 2.0, with irregular release cadence.

pip install cornac
INSTALL
IMPORT
SIG · CORNAC
C
cornac
ai-mlpythonv2.5.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Cornac
import cornac
import cornac as cornac
Common mistake: using uppercase C, but module is lowercase
RatioSplit
from cornac.data import Reader from cornac.data import RatioSplit
from cornac import RatioSplit
RatioSplit is in cornac.data, not top-level

Minimal example: load data, split, train PMF, evaluate with RMSE/MAE.

import cornac from cornac.data import Reader, RatioSplit from cornac.models import PMF, BPR, MostPop from cornac.eval_methods import BaseMethod from cornac.metrics import RMSE, MAE, Precision, Recall, NDCG # Load MovieLens 100K reader = Reader() train, test = reader.load('ml-100k', reader=Reader, min_user_freq=5, min_item_freq=2) # Evaluation method ratio_split = RatioSplit(data=train, test_size=0.2, rating_threshold=4.0, seed=42, exclude_unknowns=True) # Models pmf = PMF(k=10, max_iter=50, learning_rate=0.001, lambda_reg=0.001) # Evaluate cornac.Experiment(eval_method=ratio_split, models=[pmf], metrics=[RMSE(), MAE()]).run()
Debug
Known issues
breakingPython 3.10+ only: Cornac 2.5.0 drops support for Python 3.8 and 3.9.
fix
Upgrade Python to 3.10 or later, or install an older version (e.g., pip install cornac==2.4.2)
affects: >=2.5.0
deprecatedThe `cornac.data.Dataset` class is deprecated in favor of `cornac.data.Reader` for loading data.
fix
Use `Reader().load(...)` instead of `Dataset(...)`
affects: >=2.4.0
gotchaImplicit rating threshold: When using `RatioSplit`, the `rating_threshold` parameter is required for binary relevance metrics (e.g., Precision, Recall). Forgetting it will cause errors or incorrect results.
fix
Always specify `rating_threshold` (e.g., 4.0) when using classification metrics.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'cornac'
Cornac not installed in the current Python environment.
fix
Run `pip install cornac`
ImportError: cannot import name 'RatioSplit' from 'cornac'
RatioSplit is not in the top-level module; it's in cornac.data.
fix
Use `from cornac.data import RatioSplit`
ValueError: rating_threshold must be specified for binary classification
Missing `rating_threshold` when using metrics like Precision, Recall.
fix
Add `rating_threshold=4.0` in `RatioSplit` or `BaseMethod`.
Upgrade
Version history
2.5.0latest on PyPI · released Jun 4, 2026
Audit
Dependencies
numpyrequiredCore requirement for numerical operations
scipyrequiredSparse matrix support
tensorflowoptionalDeep learning models
pytorchoptionalAlternative deep learning backend
Agent activity
19 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources

No resource links recorded.

cornac — pip install cornac · libregistry