lenskit.funksvd#

FunkSVD (biased MF).

Functions

make_params(niters, lrate, reg, range)

train(ctx, params, model, timer)

Classes

Context(*args, **kwargs)

FunkSVDScorer(features[, iterations, lrate, ...])

Algorithm class implementing FunkSVD matrix factorization.

Model(*args, **kwargs)

Internal model class for training SGD MF.

class lenskit.funksvd.Model(*args, **kwargs)#

Bases: Model

Internal model class for training SGD MF.

class lenskit.funksvd.FunkSVDScorer(features, iterations=100, *, lrate=0.001, reg=0.015, damping=5.0, range=None, rng=None)#

Bases: Component, Trainable

Algorithm class implementing FunkSVD matrix factorization. FunkSVD is a regularized biased matrix factorization technique trained with featurewise stochastic gradient descent.

See the base class MFPredictor for documentation on the estimated parameters you can extract from a trained model.

Parameters:
  • features (int) – the number of features to train

  • iterations (int) – the number of iterations to train each feature

  • lrate (float) – the learning rate

  • reg (float) – the regularization factor

  • damping (UITuple[float]) – damping factor for the underlying mean

  • bias – the underlying bias model to fit. If True, then a bias.Bias model is fit with damping.

  • range (tuple[float, float] | None) – the (min, max) rating values to clamp ratings, or None to leave predictions unclamped.

  • rng (int | integer[Any] | Sequence[int] | SeedSequence | Generator | BitGenerator | None) – The random seed for shuffling the input data (see Random Seeds).

property is_trained: bool#

Check if this model has already been trained.

train(data)#

Train a FunkSVD model.

Parameters:
  • ratings – the ratings data frame.

  • data (Dataset)