# Hierarchical Poisson Factorization¶

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

 [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.

Parameters: features (int) – the number of features **kwargs – arguments passed to hpfrec.HPF.
predict(model: lenskit.algorithms.mf_common.MFModel, user, items, ratings=None)

Compute predictions for a user and items.

Parameters: model – the trained model to use. Either None or the ratings matrix if the algorithm has no concept of training. 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. pandas.Series
train(ratings)

Train the model on rating/consumption data. Training methods that require additional data may accept it as additional parameters or via class members.

Parameters: ratings (pandas.DataFrame) – rating data, as a matrix with columns ‘user’, ‘item’, and ‘rating’. The user and item identifiers may be of any type. the trained model (of an implementation-defined type).