lenskit.hpf#
Classes
- class lenskit.hpf.HPF(features, **kwargs)#
Bases:
MFPredictor
Hierarchical Poisson factorization, provided by hpfrec.
Todo
Right now, this uses the ‘rating’ as a count. Actually use counts.
- Parameters:
features (int) – the number of features
**kwargs – arguments passed to
hpfrec.HPF
.
- fit(data, **kwargs)#
Train a model using the specified ratings (or similar) data.
- Parameters:
data (Dataset) – The training 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.
- Returns:
The algorithm object.
- predict_for_user(user, items, ratings=None)#
Compute predictions for a user and items.
- Parameters:
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.
- Returns:
scores for the items, indexed by item id.
- Return type: