lenskit.als.ALSBase#
- class lenskit.als.ALSBase(config=None, **kwargs)#
Bases:
lenskit.training.UsesTrainer,lenskit.pipeline.Component[lenskit.data.ItemList],abc.ABCBase 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:
- __call__(query, items)#
Run the pipeline’s operation and produce a result. This is the key method for components to implement.
- Parameters:
query (lenskit.data.QueryInput)
items (lenskit.data.ItemList)
- Return type:
- abstractmethod new_user_embedding(user_num, items)#
Generate an embedding for a user given their current ratings.
- Parameters:
user_num (int | None)
items (lenskit.data.ItemList)
- 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:
user_num (int | None)
items (lenskit.data.ItemList)
user_bias (float | None)
- Return type: