alpenglow.experiments package

Submodules

alpenglow.experiments.AsymmetricFactorExperiment module

class alpenglow.experiments.AsymmetricFactorExperiment.AsymmetricFactorExperiment(dimension=10, begin_min=-0.01, begin_max=0.01, learning_rate=0.05, regularization_rate=0.0, negative_rate=20, cumulative_item_updates=True, norm_type="exponential", "gamma"=0.8)[source]

Bases: alpenglow.OnlineExperiment.OnlineExperiment

Implements the recommendation model introduced in [Paterek2007].

[Paterek2007]Arkadiusz Paterek. „Improving regularized singular value decomposition for collaborative filtering”. In: Proc. KDD Cup Workshop at SIGKDD’07, 13th ACM Int. Conf. on Knowledge Discovery and Data Mining. San Jose, CA, USA, 2007, pp. 39–42.
Parameters:
  • dimension (int) – The latent factor dimension of the factormodel.
  • begin_min (double) – The factors are initialized randomly, sampling each element uniformly from the interval (begin_min, begin_max).
  • begin_max (double) – See begin_min.
  • learning_rate (double) – The learning rate used in the stochastic gradient descent updates.
  • regularization_rate (double) – The coefficient for the L2 regularization term.
  • negative_rate (int) – The number of negative samples generated after each update. Useful for implicit recommendation.
  • norm_type (str) – Type of time decay; either “constant”, “exponential” or “none”.
  • gamma (double) – Coefficient of time decay in the case of norm_type == “exponential”.

alpenglow.experiments.BatchAndOnlineFactorExperiment module

class alpenglow.experiments.BatchAndOnlineFactorExperiment.BatchAndOnlineFactorExperiment(dimension=10, begin_min=-0.01, begin_max=0.01, batch_learning_rate=0.05, batch_regularization_rate=0.0, batch_negative_rate=70, online_learning_rate=0.05, online_regularization_rate=0.0, online_negative_rate=100)[source]

Bases: alpenglow.OnlineExperiment.OnlineExperiment

Combines BatchFactorExperiment and FactorExperiment by updating the model both in batch and continously.

Parameters:
  • dimension (int) – The latent factor dimension of the factormodel.
  • begin_min (double) – The factors are initialized randomly, sampling each element uniformly from the interval (begin_min, begin_max).
  • begin_max (double) – See begin_min.
  • batch_learning_rate (double) – The learning rate used in the batch stochastic gradient descent updates.
  • batch_regularization_rate (double) – The coefficient for the L2 regularization term for batch updates.
  • batch_negative_rate (int) – The number of negative samples generated after each batch update. Useful for implicit recommendation.
  • online_learning_rate (double) – The learning rate used in the online stochastic gradient descent updates.
  • online_regularization_rate (double) – The coefficient for the L2 regularization term for online updata.
  • online_negative_rate (int) – The number of negative samples generated after online each update. Useful for implicit recommendation.

alpenglow.experiments.BatchFactorExperiment module

class alpenglow.experiments.BatchFactorExperiment.BatchFactorExperiment(dimension=10, begin_min=-0.01, begin_max=0.01, learning_rate=0.05, regularization_rate=0.0, negative_rate=0.0, number_of_iterations=3, period_length=86400)[source]

Bases: alpenglow.OnlineExperiment.OnlineExperiment

Batch version of alpenglow.experiments.FactorExperiment.FactorExperiment, meaning it retrains its model periodically nd evaluates the latest model between two training points in an online fashion.

Parameters:
  • dimension (int) – The latent factor dimension of the factormodel.
  • begin_min (double) – The factors are initialized randomly, sampling each element uniformly from the interval (begin_min, begin_max).
  • begin_max (double) – See begin_min.
  • learning_rate (double) – The learning rate used in the stochastic gradient descent updates.
  • regularization_rate (double) – The coefficient for the L2 regularization term.
  • negative_rate (int) – The number of negative samples generated after each update. Useful for implicit recommendation.
  • number_of_iterations (int) – The number of iterations over the data in model retrain.
  • period_length (int) – The amount of time between model retrains (seconds).

alpenglow.experiments.FactorExperiment module

class alpenglow.experiments.FactorExperiment.FactorExperiment(dimension=10, begin_min=-0.01, begin_max=0.01, learning_rate=0.05, regularization_rate=0.0, negative_rate=0.0)[source]

Bases: alpenglow.OnlineExperiment.OnlineExperiment

This class implements the well-known matrix factorization recommendation model [Koren2009] and trains it via stochastic gradient descent. The model is able to train on implicit data as well using negative sample generation, see [X.He2016] and the negative_rate parameter.

[Koren2009]Koren, Yehuda, Robert Bell, and Chris Volinsky. “Matrix factorization techniques for recommender systems.” Computer 42.8 (2009).
[X.He2016]
  1. He, H. Zhang, M.-Y. Kan, and T.-S. Chua. Fast matrix factorization for online recommendation with implicit feedback. In SIGIR, pages 549–558, 2016.
Parameters:
  • dimension (int) – The latent factor dimension of the factormodel.
  • begin_min (double) – The factors are initialized randomly, sampling each element uniformly from the interval (begin_min, begin_max).
  • begin_max (double) – See begin_min.
  • learning_rate (double) – The learning rate used in the stochastic gradient descent updates.
  • regularization_rate (double) – The coefficient for the L2 regularization term.
  • negative_rate (int) – The number of negative samples generated after each update. Useful for implicit recommendation.

alpenglow.experiments.NearestNeighborExperiment module

class alpenglow.experiments.NearestNeighborExperiment.NearestNeighborExperiment(**parameters)[source]

Bases: alpenglow.OnlineExperiment.OnlineExperiment

alpenglow.experiments.PersonalPopularityExperiment module

class alpenglow.experiments.PersonalPopularityExperiment.PersonalPopularityExperiment(**parameters)[source]

Bases: alpenglow.OnlineExperiment.OnlineExperiment

Recommends the item that the user has watched the most so far; in case of a tie, it falls back to global popularity. Running this model in conjunction with exclude_known == True is not recommended.

alpenglow.experiments.PopularityExperiment module

class alpenglow.experiments.PopularityExperiment.PopularityExperiment(**parameters)[source]

Bases: alpenglow.OnlineExperiment.OnlineExperiment

Recommends the most popular item from the set of items seen so far.

alpenglow.experiments.PopularityTimeframeExperiment module

class alpenglow.experiments.PopularityTimeframeExperiment.PopularityTimeframeExperiment(tau=86400)[source]

Bases: alpenglow.OnlineExperiment.OnlineExperiment

Time-aware version of PopularityModel, which only considers the last tau time interval when calculating popularities.

Parameters:tau (int) – The time amount to consider.

alpenglow.experiments.SvdppExperiment module

class alpenglow.experiments.SvdppExperiment.SvdppExperiment(**parameters)[source]

Bases: alpenglow.OnlineExperiment.OnlineExperiment

alpenglow.experiments.TransitionProbabilityExperiment module

class alpenglow.experiments.TransitionProbabilityExperiment.TransitionProbabilityExperiment(**parameters)[source]

Bases: alpenglow.OnlineExperiment.OnlineExperiment

Module contents