Hierarchical Poisson Factorization

This module provides a LensKit bridge to the hpfrec library implementing hierarchical Poisson factorization [GHB2013].


Prem Gopalan, Jake M. Hofman, and David M. Blei. 2013. Scalable Recommendation with Poisson Factorization. arXiv:1311.1704 [cs, stat] (November 2013). Retrieved February 9, 2017 from http://arxiv.org/abs/1311.1704.

class lenskit.algorithms.hpf.HPF(features, **kwargs)

Hierarchical Poisson factorization, provided by hpfrec.

  • features (int) – the number of features

  • **kwargs – arguments passed to hpfrec.HPF.

fit(ratings, **kwargs)

Train a model using the specified ratings (or similar) data.

  • ratings (pandas.DataFrame) – The ratings data.

  • kwargs – Additional training data the algorithm may require. Algorithms should avoid using the same keyword arguments for different purposes, so that they can be more easily hybridized.


The algorithm object.

predict_for_user(user, items, ratings=None)

Compute predictions for a user and items.

  • user – the user ID

  • items (array-like) – the items to predict

  • ratings (pandas.Series) – the user’s ratings (indexed by item id); if provided, they may be used to override or augment the model’s notion of a user’s preferences.


scores for the items, indexed by item id.

Return type