lenskit.sklearn.nmf.NMFScorer#

class lenskit.sklearn.nmf.NMFScorer(config=None, **kwargs)#

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

Non-negative matrix factorization for implicit feedback using SciKit-Learn’s sklearn.decomposition.non_negative_factorization(). It computes the user and item embedding matrices using an indicator matrix as the input.

Stability:
Caller (see Stability Levels).
Parameters:
  • config (object | None)

  • kwargs (Any)

config: NMFConfig#

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#
items: lenskit.data.Vocabulary#
user_components: lenskit.data.types.NPMatrix#
item_components: lenskit.data.types.NPMatrix#
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