lenskit.hpf.HPFScorer#

class lenskit.hpf.HPFScorer(config=None, **kwargs)#

Bases: lenskit.pipeline.Component[lenskit.data.ItemList], lenskit.training.Trainable

Hierarchical Poisson factorization, provided by hpfrec

Todo

Right now, this uses the ‘rating’ as a count. Actually use counts (🐞 656).

Stability:

Experimental

Parameters:
  • features – the number of features

  • kwargs (Any) – additional arguments to pass to hpfrec.HPF.

  • config (object | None)

config: HPFConfig#

The component configuration object. Component classes that support configuration must redefine this attribute with their specific configuration class type, which can be a Python dataclass or a Pydantic model class.

users: lenskit.data.Vocabulary#
user_features: numpy.ndarray[tuple[int, int], numpy.dtype[numpy.float64]]#
items: lenskit.data.Vocabulary#
item_features: numpy.ndarray[tuple[int, int], numpy.dtype[numpy.float64]]#
is_trained()#

Query if this component has already been trained.

train(data, options=TrainingOptions())#

Train the model to learn its parameters from a training dataset.

Parameters:
__call__(query, items)#

Run the pipeline’s operation and produce a result. This is the key method for components to implement.

Parameters:
Return type:

lenskit.data.ItemList