lenskit.als.ALSBase#

class lenskit.als.ALSBase(config=None, **kwargs)#

Bases: lenskit.training.UsesTrainer, lenskit.pipeline.Component[lenskit.data.ItemList], abc.ABC

Base class for ALS models.

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

  • kwargs (Any)

config: ALSConfig#

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 | None#
items: lenskit.data.Vocabulary#
user_embeddings: lenskit.data.types.NPMatrix | None#
item_embeddings: lenskit.data.types.NPMatrix#
property logger: structlog.stdlib.BoundLogger#
Return type:

structlog.stdlib.BoundLogger

__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

abstractmethod new_user_embedding(user_num, items)#

Generate an embedding for a user given their current ratings.

Parameters:
Return type:

tuple[lenskit.data.types.NPVector[numpy.float32], float | None]

finalize_scores(user_num, items, user_bias)#

Perform any final transformation of scores prior to returning them.

Parameters:
Return type:

lenskit.data.ItemList