lenskit.hpf#

Hierarchical Poisson factorization from hpfrec.

Classes

HPFConfig(*[, count_attribute, embedding_size])

Configuration class for HPFScorer.

HPFScorer([config])

Hierarchical Poisson factorization, provided by hpfrec

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

Bases: BaseModel

Configuration class for HPFScorer.

Only a couple of configuration options are directly defined here. Other options are taken from the hpfrec.HPF constructor’s keyword arguments.

Parameters:
  • count_attribute (str | None)

  • embedding_size (int)

  • extra_data (Any)

count_attribute: str | None#

The attribute from which to get user-item interaction counts. If None, uses indicator variables as a count of 1.

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 (🐞 656).

Stability:

Experimental

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: