baserec.matrix_factorization package

Submodules

baserec.matrix_factorization.ials_recommender module

@author: Maurizio Ferrari Dacrema & Ceshine Lee

class baserec.matrix_factorization.ials_recommender.IALSRecommender(URM_train, verbose=True)

Bases: baserec.base.base_matrix_factorization_recommender.BaseMatrixFactorizationRecommender, baserec.base.incremental_training_early_stopping.IncrementalTrainingEarlyStopping

Binary/Implicit Alternating Least Squares (IALS) See: Y. Hu, Y. Koren and C. Volinsky, Collaborative filtering for implicit feedback datasets, ICDM 2008. http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.167.5120&rep=rep1&type=pdf

R. Pan et al., One-class collaborative filtering, ICDM 2008. http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.306.4684&rep=rep1&type=pdf

Factorization model for binary feedback. First, splits the feedback matrix R as the element-wise a Preference matrix P and a Confidence matrix C. Then computes the decomposition of them into the dot product of two matrices X and Y of latent factors. X represent the user latent factors, Y the item latent factors.

The model is learned by solving the following regularized Least-squares objective function with Stochastic Gradient Descent operatornamewithlimits{argmin}limits_{x*,y*}

rac{1}{2}sum_{i,j}{c_{ij}(p_{ij}-x_i^T y_j) + lambda(sum_{i}{||x_i||^2} + sum_{j}{||y_j||^2})}

AVAILABLE_CONFIDENCE_SCALING = ['linear', 'log']
RECOMMENDER_NAME = 'IALSRecommender'
fit(epochs=300, num_factors=20, confidence_scaling='linear', alpha=1.0, epsilon=1.0, reg=0.001, init_mean=0.0, init_std=0.1, **earlystopping_kwargs)
Parameters
  • epochs

  • num_factors

  • confidence_scaling – supported scaling modes for the observed values: ‘linear’ or ‘log’

  • alpha – Confidence weight, confidence c = 1 + alpha*r where r is the observed “rating”.

  • reg – Regularization constant.

  • epsilon – epsilon used in log scaling only

  • init_mean – mean used to initialize the latent factors

  • init_std – standard deviation used to initialize the latent factors

Returns

Module contents