lenskit.implicit#

Classes

ALS(*args[, weight])

LensKit interface to implicit.cpu.als (or GPU version).

BPR(*args, **kwargs)

LensKit interface to implicit.cpu.bpr (or GPU version).

BaseRec(delegate)

Base class for Implicit-backed recommenders.

class lenskit.implicit.BaseRec(delegate)#

Bases: Component, Trainable

Base class for Implicit-backed recommenders.

Parameters:

delegate (RecommenderBase) – The delegate algorithm.

matrix_: csr_matrix#

The user-item rating matrix from training.

users_: Vocabulary#

The user ID mapping from training.

items_: Vocabulary#

The item ID mapping from training.

delegate: RecommenderBase#

The delegate algorithm from implicit.

weight: float#

The weight for positive examples (only used by some algorithms).

property is_trained#

Check if this model has already been trained.

train(data)#

Train the pipeline component to learn its parameters from a training dataset.

Parameters:
  • data (Dataset) – The training dataset.

  • retrain – If True, retrain the model even if it has already been trained.

class lenskit.implicit.ALS(*args, weight=40.0, **kwargs)#

Bases: BaseRec

LensKit interface to implicit.cpu.als (or GPU version).

class lenskit.implicit.BPR(*args, **kwargs)#

Bases: BaseRec

LensKit interface to implicit.cpu.bpr (or GPU version).