File predictor.hpp

template<typename PredictionMatrix>
class IIncrementalPredictor
#include <predictor.hpp>

Defines an interface for all classes that allow to obtain predictions for given query examples incrementally.

Template Parameters:

PredictionMatrix – The type of the matrix that is used to store the predictions

Subclassed by AbstractIncrementalPredictor< FeatureMatrix, Model, PredictionMatrix >

Public Functions

inline virtual ~IIncrementalPredictor()
inline virtual bool hasNext() const

Returns whether there are any remaining ensemble members that have not been used yet or not.

Returns:

True, if there are any remaining ensemble members, false otherwise

virtual uint32 getNumNext() const = 0

Returns the number of remaining ensemble members that have not been used yet.

Returns:

The number of remaining ensemble members

virtual PredictionMatrix &applyNext(uint32 stepSize) = 0

Updates the current predictions by considering several of the remaining ensemble members. If not enough ensemble members are remaining, only the available ones will be used for updating the current predictions.

Parameters:

stepSize – The number of additional ensemble members to be considered for prediction

Returns:

A reference to an object of template type PredictionMatrix that stores the updated predictions

template<typename PredictionMatrix>
class IPredictor
#include <predictor.hpp>

Defines an interface for all classes that allow to obtain predictions for given query examples.

Template Parameters:

PredictionMatrix – The type of the matrix that is used to store the predictions

Public Functions

inline virtual ~IPredictor()
virtual std::unique_ptr<PredictionMatrix> predict(uint32 maxRules = 0) const = 0

Obtains and returns predictions for all query examples.

Parameters:

maxRules – The maximum number of rules to be used for prediction or 0, if the number of rules should not be restricted

Returns:

An unique pointer to an object of template type PredictionMatrix that stores the predictions

virtual bool canPredictIncrementally() const = 0

Returns whether the predictor allows to obtain predictions incrementally or not.

Returns:

True, if the predictor allows to obtain predictions incrementally, false otherwise

virtual std::unique_ptr<IIncrementalPredictor<PredictionMatrix>> createIncrementalPredictor(uint32 maxRules = 0) const = 0

Creates and returns a predictor that may be used to obtain predictions incrementally. If incremental prediction is not supported, a std::runtime_error is thrown.

Throws:

std::runtime_exception – The exception that is thrown if incremental prediction is not supported

Parameters:

maxRules – The maximum number of rules to be used for prediction. Must be at least 1 or 0, if the number of rules should not be restricted

Returns:

An unique pointer to an object of type IIncrementalPredictor that may be used to obtain predictions incrementally

template<typename PredictorFactory>
class IPredictorConfig
#include <predictor.hpp>

Defines an interface for all classes that allow to configure a predictor.

Template Parameters:

PredictorFactory – The type of the factory that allows to create instances of the predictor

Public Functions

inline virtual ~IPredictorConfig()
virtual std::unique_ptr<PredictorFactory> createPredictorFactory(const IRowWiseFeatureMatrix &featureMatrix, uint32 numLabels) const = 0

Creates and returns a new object of type IPredictorFactory according to the specified configuration.

Parameters:
  • featureMatrix – A reference to an object of type IRowWiseFeatureMatrix that provides row-wise access to the feature values of the query examples to predict for

  • numLabels – The number of labels to predict for

Returns:

An unique pointer to an object of template type PredictorFactory that has been created

virtual bool isLabelVectorSetNeeded() const = 0

Returns whether the predictor needs access to the label vectors that are encountered in the training data or not.

Returns:

True, if the predictor needs access to the label vectors that are encountered in the training data, false otherwise