lenskit.hpf#

Hierarchical Poisson factorization from hpfrec.

Note

This package is not included in the base lenskit distribution. Install lenskit-hpf from PyPI or Conda to get it.

Classes

HPFConfig(*[, embedding_size])

HPFScorer([config])

Hierarchical Poisson factorization, provided by hpfrec.

class lenskit.hpf.HPFConfig(*, embedding_size=50, **extra_data)#

Bases: BaseModel

Parameters:
  • embedding_size (int)

  • extra_data (Any)

embedding_size: int#

The dimension of user and item embeddings (number of latent features to learn).

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

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

Bases: Component[ItemList, …], Trainable

Hierarchical Poisson factorization, provided by hpfrec.

Todo

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

Stability:
Caller (see Stability Levels).
Parameters:
  • features – the number of features

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

  • config (HPFConfig)

train(data, options=TrainingOptions(retrain=True, device=None, rng=None))#

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

Parameters: