lenskit.algorithms.als.explicit#
Classes
|
Biased matrix factorization trained with alternating least squares [ZWSP08]. |
- class lenskit.algorithms.als.explicit.BiasedMF(features, *, epochs=10, reg=0.1, damping=5, bias=True, rng_spec=None, save_user_features=True)#
Bases:
ALSBase
Biased matrix factorization trained with alternating least squares [ZWSP08]. This is a prediction-oriented algorithm suitable for explicit feedback data, using the alternating least squares approach to compute \(P\) and \(Q\) to minimize the regularized squared reconstruction error of the ratings matrix.
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 epochs: the number of
reg (float | tuple[float, float]) – the regularization factor; can also be a tuple
`` (ureg, ireg) – specify separate user and item regularization terms.
damping (float) – damping factor for the underlying bias. bias: the bias model.
True (If) – damping
damping
.epochs (int)
reg
bias (Bias | None)
rng_spec (Optional[SeedLike])
save_user_features (bool)
:param fits a
Bias
with: dampingdamping
. :param rng_spec: Random number generator or state (seeseedbank.numpy_rng()
). :param progress: atqdm.tqdm()
-compatible progress bar function- property logger#
Overridden in implementation to provide the logger.
- prepare_data(data)#
Prepare data for training this model. This takes in the ratings, and is supposed to do two things:
Normalize or transform the rating/interaction data, as needed, for training.
Store any parameters learned from the normalization (e.g. means) in the appropriate member variables.
Return the training data object to use for model training.
- Parameters:
data (Dataset)
- initial_params(nrows, ncols)#
Compute initial parameter values of the specified shape.
- als_half_epoch(epoch, context)#
Run one half of an ALS training epoch.
- Parameters:
epoch (int)
context (TrainContext)
- new_user_embedding(user, ratings)#
Generate an embedding for a user given their current ratings.