class implicit.bpr.BayesianPersonalizedRanking

Bayesian Personalized Ranking

A recommender model that learns a matrix factorization embedding based off minimizing the pairwise ranking loss described in the paper BPR: Bayesian Personalized Ranking from Implicit Feedback.

This factory function returns either the cpu implementation from implicit.cpu.bpr or the gpu implementation from implicit.gpu.bpr depending on the value of the use_gpu flag.

  • factors (int, optional) – The number of latent factors to compute
  • learning_rate (float, optional) – The learning rate to apply for SGD updates during training
  • regularization (float, optional) – The regularization factor to use
  • dtype (data-type, optional) – Specifies whether to generate 64 bit or 32 bit floating point factors
  • use_gpu (bool, optional) – Fit on the GPU if available
  • iterations (int, optional) – The number of training epochs to use when fitting the data
  • verify_negative_samples (bool, optional) – When sampling negative items, check if the randomly picked negative item has actually been liked by the user. This check increases the time needed to train but usually leads to better predictions.
  • num_threads (int, optional) – The number of threads to use for fitting the model. This only applies for the native extensions. Specifying 0 means to default to the number of cores on the machine.
  • random_state (int, RandomState or None, optional) – The random state for seeding the initial item and user factors. Default is None.