*Incremental Collaborative Filtering* algorithms.

Step Base

This class defines the interface that every Step module should implement. Namely, each class should implement five methods:

  • batch_fit: To support batch training
  • step: To support incremental learning
  • predict: To offer recommendations
  • save: To save the model parameters
  • load: To load the model parameters

class StepBase[source]

StepBase()

Defines the interface that all step models here expose.

Step

The step class implements the basic Incremental Collaborative Filtering recommender system.

class Step[source]

Step(model:Module, objective:Callable, optimizer:Callable, conf_func:Callable='<lambda>', device:str='cpu') :: StepBase

Incremental and batch training of recommender systems.

Arguments:

  • model (torch.nn.Module): The neural network architecture
  • objective (Callable): The objective function
  • optimizer (Callable): The method used to optimize the objective function. Usually a torch.optim loss function
  • conf_func (Callable): A method that converts implicit ratings to confidence scores
  • device (str): Either cpu or gpu

Step.batch_fit[source]

Step.batch_fit(data_loader:DataLoader, epochs:int=1)

Trains the model on a batch of user-item interactions.

Step.step[source]

Step.step(user:tensor, item:tensor, rating:tensor=None, preference:tensor=None)

Trains the model incrementally.

Step.predict[source]

Step.predict(user:tensor, k:int=10)

Recommends the top-k items to a specific user.

Step.save[source]

Step.save(path:str)

Saves the model parameters to the given path.

Step.load[source]

Step.load(path:str)

Loads the model parameters from a given path.