alpenglow.cpp package

The classes in this module are usually not used directly, but instead through the alpenglow.Getter class. For more info, read

Note that there are some C++ classes that have no python interface. These are not documented here.

Filters

The function of the filter interface is limiting the available set of items. Current filters are whitelist-type filters, implementing alpenglow.cpp.WhitelistFilter.

To use a filter in an experiment, wrap the model into the filter using alpenglow.cpp.WhitelistFilter2ModelAdapter.

Example:

class LabelExperiment(prs.OnlineExperiment):
    '''Sample experiment illustrating the usage of LabelFilter. The
    experiment contains a PopularityModel and a LabelFilter.'''
    def _config(self, top_k, seed):
        model = ag.PopularityModel()
        updater = ag.PopularityModelUpdater()
        updater.set_model(model)
        label_filter = ag.LabelFilter(**self.parameter_defaults(
            label_file_name = ""
        ))
        adapter = ag.WhitelistFilter2ModelAdapter()
        adapter.set_model(model)
        adapter.set_whitelist_filter(label_filter)

Offline evaluators

Use offline evaluators in traditional, fixed train/test split style learning. Check the code of alpenglow.offline.OfflineModel.OfflineModel descendants for usage examples.

Recommender data

This module contains the classes that are responsible for reading in the dataset and serving it to other classes of the experiment.

Interface alpenglow.cpp.RecommenderData is the anchestor for classes that read in the dataset. The two most frequently used implementations are alpenglow.cpp.DataframeData and alpenglow.cpp.LegacyRecommenderData.

Interface alpenglow.cpp.RecommenderDataIterator is the anchestor for classes that serve the data to the classes in the online experiment. See The anatomy of an online experiment for general information. The most frequently used implementations are alpenglow.cpp.ShuffleIterator and alpenglow.cpp.SimpleIterator.

Utils

This module contains miscellaneous helper classes.

Gradient computers

This module contains the gradient computer classes that implement gradient computation necessary in gradient methods. See alpenglow.experiments.FactorExperiment for an example.

Objectives

This module contains the implementation of objective functions that are necessary for gradient computation in gradient learning methods. See alpenglow.experiments.FactorExperiment for a usage example.

General interfaces

This module contains the general interfaces that are implemented by classes belonging to different modules.

Negative sample generators

All the samples in an implicit dataset are positive samples. To make gradient methods work, we need to provide negative samples too. This module contains classes that implement different negative sample generation algorithms. These classes implement alpenglow.cpp.NegativeSampleGenerator. The most frequently used implementation is alpenglow.cpp.UniformNegativeSampleGenerator.

Offline learners

Use offline learners in traditional, fixed train/test split style learning. Check the code of alpenglow.offline.OfflineModel.OfflineModel descendants for usage examples.

Loggers

Loggers implement evaluators, statistics etc. in the online experiment. These classes implement interface alpenglow.cpp.Logger. See The anatomy of an online experiment for a general view.

Online experiment

The central classes of the online experiments.

Models

The prediction models in the experiments. The model interface is alpenglow.cpp.Model. See Rank computation optimization about different evaluation methods.

Factor models

This module contains the matrix factorization based models.

Baseline models

This submodule contains the simple baseline models like nearest neighbor or most popular.

Model combination

This module contains the models that combine other models. The most frequently used class is alpenglow.cpp.CombinedModel. See Model combination for a usage example.

Data generators

The classes in this module are responsible for generating data subsets from the past. This is necessary for embedding offline models into the online framework, that needs to be updated in a batch. See alpenglow.experiments.BatchFactorExperiment for a usage example.

Online learners

This module contains classes that modifiy the learning process, e.g. delay the samples or feed them in a batch into offline learning methods.