Test.fm is (yet another) testing framework for Collaborative Filtering models. It integrates well with pandas as the default data manipulation library and gives an easy way to investigate how well your models perform and why. You can build a model using okapi and then check how it performs on the testing data. Or if you have only a little data set, you can use it directly.
import pandas as pd
import testfm
from testfm.models.baseline_model import Popularity, RandomModel
from testfm.models.tensorcofi import TensorCoFi
from testfm.evaluation.evaluator import Evaluator
evaluator = Evaluator()
# Prepare the data
df = pd.read_csv(..., names=["user", "item", "rating", "date", "title"])
training, testing = testfm.split.holdoutByRandom(df, 0.9)
# Tell me what models we want to evaluate
models = [
RandomModel(),
Popularity(),
TensorCoFi()
]
# Evaluate
items = training.item.unique()
for m in models:
m.fit(training)
print m.getName().ljust(50),
print evaluator.evaluate_model(m, testing, all_items=items)
See other examples here...
You can check the official documentation here.
- download and extract the sources.
- check the dependencies in conf/requirements.txt
- run #sudo python setup.py install
- if you are a developer of test.fm better do python setup.py develop
- enjoy and contribute
- Check travis for the latest builds...
- Check yaml for the build script.
$ nosetests -w src/ -vv --with-cover --cover-tests --cover-erase --cover-html --cover-package=testfm --with-doctest --doctest-tests tests testfm/evaluation testfm/models testfm/fmio testfm/splitter
$ sphinx-build -b html source_folder doc_folder
- mrec from Mendeley. Good at building models. (python, ?)
- okapi from Telefonica Research. Good at distributed model building using Apache Giraph (java, giraph, apache2).
- graphlab from CMU. Probably the richest library of modern algorithms (c++, apache2).
- mymedialite from Uni Hildesheim. Has ranking implementations. (c#, GPL).
- mahout of apache. Uses hadoop to build the models. (java, hadoop, apache2)
- lenskit Grouplens (java, GPL2.1)