recpack.algorithms.TopKItemSimilarityMatrixAlgorithm

class recpack.algorithms.TopKItemSimilarityMatrixAlgorithm(K)

Base algorithm for algorithms that fit an item to item similarity model with K similar items for every item

Model that encodes the similarity between items is expected under the similarity_matrix_ attribute.

This matrix should have shape (|items| x |items|). This can be dense or sparse matrix depending on the algorithm used.

Predictions are made by computing the dot product of the history vector of a user and the similarity matrix.

Usually a new algorithm will have to implement just the _fit() method, to construct the self.similarity_matrix_ attribute.

Parameters

K (int) – How many similar items will be kept per item.

Methods

Attributes

identifier

Name of the object.

name

Name of the object's class.