File predictor_score_common.hpp

namespace boosting

Functions

static inline void applyHead(const CompleteHead &head, View<float64>::iterator iterator)
static inline void applyHead(const PartialHead &head, View<float64>::iterator iterator)
static inline void applyHead(const IHead &head, View<float64>::iterator scoreIterator)
static inline void applyRule(const RuleList::Rule &rule, View<const float32>::const_iterator featureValuesBegin, View<const float32>::const_iterator featureValuesEnd, View<float64>::iterator scoreIterator)
static inline void applyRules(RuleList::const_iterator rulesBegin, RuleList::const_iterator rulesEnd, View<const float32>::const_iterator featureValuesBegin, View<const float32>::const_iterator featureValuesEnd, View<float64>::iterator scoreIterator)
static inline void applyRule(const RuleList::Rule &rule, View<uint32>::const_iterator featureIndicesBegin, View<uint32>::const_iterator featureIndicesEnd, View<float32>::const_iterator featureValuesBegin, View<float32>::const_iterator featureValuesEnd, float32 sparseFeatureValue, View<float64>::iterator scoreIterator, View<float32>::iterator tmpArray1, View<uint32>::iterator tmpArray2, uint32 n)
static inline void applyRules(RuleList::const_iterator rulesBegin, RuleList::const_iterator rulesEnd, uint32 numFeatures, View<uint32>::const_iterator featureIndicesBegin, View<uint32>::const_iterator featureIndicesEnd, View<float32>::const_iterator featureValuesBegin, View<float32>::const_iterator featureValuesEnd, float32 sparseFeatureValue, View<float64>::iterator scoreIterator)
static inline void aggregatePredictedScores(const CContiguousView<const float32> &featureMatrix, RuleList::const_iterator rulesBegin, RuleList::const_iterator rulesEnd, CContiguousView<float64> &scoreMatrix, uint32 exampleIndex, uint32 predictionIndex)
static inline void aggregatePredictedScores(const CsrView<const float32> &featureMatrix, RuleList::const_iterator rulesBegin, RuleList::const_iterator rulesEnd, CContiguousView<float64> &scoreMatrix, uint32 exampleIndex, uint32 predictionIndex)
template<typename FeatureMatrix, typename Model>
class ScorePredictionDelegate : public PredictionDispatcher::IPredictionDelegate
#include <predictor_score_common.hpp>

An implementation of the type PredictionDispatcher::IPredictionDelegate that aggregates the scores that are predicted by the individual rules in a model and stores them in a matrix.

Template Parameters:
  • FeatureMatrix – The type of the feature matrix that provides row-wise access to the feature values of the query examples

  • Model – The type of the rule-based model that is used to obtain predictions

Public Functions

inline ScorePredictionDelegate(CContiguousView<float64> &scoreMatrix)
Parameters:

scoreMatrix – A reference to an object of type CContiguousView that should be used to store the aggregated scores

inline void predictForExample(const FeatureMatrix &featureMatrix, typename Model::const_iterator rulesBegin, typename Model::const_iterator rulesEnd, uint32 threadIndex, uint32 exampleIndex, uint32 predictionIndex) const override

See also

PredictionDispatcher::IPredictionDelegate::predictForExample

Private Members

CContiguousView<float64> &scoreMatrix_
template<typename FeatureMatrix, typename Model>
class ScorePredictor : public IScorePredictor
#include <predictor_score_common.hpp>

An implementation of the type IScorePredictor that allows to predict label-wise regression scores for given query examples by summing up the scores that are predicted by individual rules in a rule-based model for each label individually.

Template Parameters:
  • FeatureMatrix – The type of the feature matrix that provides row-wise access to the feature values of the query examples

  • Model – The type of the rule-based model that is used to obtain predictions

Public Functions

inline ScorePredictor(const FeatureMatrix &featureMatrix, const Model &model, uint32 numLabels, uint32 numThreads)
Parameters:
  • featureMatrix – A reference to an object of template type FeatureMatrix that provides row-wise access to the feature values of the query examples

  • model – A reference to an object of template type Model that should be used to obtain predictions

  • numLabels – The number of labels to predict for

  • numThreads – The number of CPU threads to be used to make predictions for different query examples in parallel. Must be at least 1

inline std::unique_ptr<DensePredictionMatrix<float64>> predict(uint32 maxRules) const override

See also

IPredictor::predict

inline bool canPredictIncrementally() const override

See also

IPredictor::canPredictIncrementally

inline std::unique_ptr<IIncrementalPredictor<DensePredictionMatrix<float64>>> createIncrementalPredictor(uint32 maxRules) const override

See also

IPredictor::createIncrementalPredictor

Private Members

const FeatureMatrix &featureMatrix_
const Model &model_
const uint32 numLabels_
const uint32 numThreads_
class IncrementalPredictor : public AbstractIncrementalPredictor<FeatureMatrix, Model, DensePredictionMatrix<float64>>

Public Functions

inline IncrementalPredictor(const ScorePredictor &predictor, uint32 maxRules)

Protected Functions

inline DensePredictionMatrix<float64> &applyNext(const FeatureMatrix &featureMatrix, uint32 numThreads, typename Model::const_iterator rulesBegin, typename Model::const_iterator rulesEnd) override

Private Members

DensePredictionMatrix<float64> predictionMatrix_