streamsightv2.algorithms

The algorithms module in streamsight contains a collection of baseline algorithms and various of the item-based KNN collaborative filtering algorithm. A total of 3 variation of the item-based KNN algorithm is implemented in the module. Which are listed below

Algorithm

Base class for all algorithms. Programmer should inherit from this class when implementing a new algorithm. It provides a common interface for all algorithms such that the expected methods and properties are defined to avoid any runtime errors.

Algorithm()

Base class for all streamsight algorithm implementations.

Baseline Algorithms

The baseline algorithms are simple algorithms that can be used as a reference point to compare the performance of the more complex algorithms. The following baseline algorithms are implemented in the module.

Random([K, seed])

Random recommendation for users.

RecentPopularity([K])

A popularity-based algorithm which only considers popularity of the latest train data.

DecayPopularity([K])

A popularity-based algorithm with exponential decay over data from earlier time windows.

MostPop([K])

A popularity-based algorithm with based on MostPop by accumulating data from earlier time windows.

Item Similarity Algorithms

Item similarity algorithms exploit relationships between items to make recommendations. At prediction time, the user is represented by the items they have interacted with. 3 variations of the item-based KNN algorithm are implemented in the module. Each variation is to showcase the difference in the learning and prediction of the algorithm. We note that no one algorithm is better than the other, and it greatly depends on the dataset and parameters used in the algorithm which would yield the best performance.

ItemKNN([K])

Item K Nearest Neighbours model.

ItemKNNIncremental([K, pad_with_popularity])

Incremental version of ItemKNN algorithm.

ItemKNNIncrementalMovieLens100K([K, metadata])

Incremental version of ItemKNN algorithm with MovieLens100k Metadata.

ItemKNNRolling([K])

Rolling version of ItemKNN algorithm.

ItemKNNStatic([K])

Static version of ItemKNN algorithm.

Time-Aware Item Similarity Algorithms

This is an extension of the item-based KNN algorithm. The time-aware item-based KNN algorithms applies a decay factor to the timestamps of interactions. This gives heavier weight to interactions that are more recent.

TARSItemKNN([K, pad_with_popularity, ...])

Framework for time aware variants of the ItemKNN algorithm.

TARSItemKNNLiu([K, pad_with_popularity, ...])

Time aware variant of ItemKNN which uses an exponential decay function and cosine similarity.

TARSItemKNNVaz([K, pad_with_popularity, ...])

Time aware variant of ItemKNN which uses a exponential decay function and pearson similarity.

TARSItemKNNDing([K, pad_with_popularity, ...])

Time aware variant of ItemKNN which uses an exponential decay function at prediction time and cosine similarity.