File predictor_binary_common.hpp¶
-
namespace boosting
-
template<typename FeatureMatrix, typename Model>
class BinaryPredictor : public IBinaryPredictor¶ - #include <predictor_binary_common.hpp>
An implementation of the type
IBinaryPredictorthat allows to predict binary labels for given query examples by summing up the scores that are predicted by individual rules in a rule-based model and transforming the aggregated scores into binary predictions in {0, 1} according to anIBinaryTransformation.- 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 BinaryPredictor(const FeatureMatrix &featureMatrix, const Model &model, uint32 numLabels, MultiThreadingSettings multiThreadingSettings, std::unique_ptr<IBinaryTransformation> binaryTransformationPtr)¶
- Parameters:
featureMatrix – A reference to an object of template type
FeatureMatrixthat provides row-wise access to the feature values of the query examplesmodel – A reference to an object of template type
Modelthat should be used to obtain predictionsnumLabels – The number of labels to predict for
multiThreadingSettings – An object of type
MultiThreadingSettingsthat stores settings to be used for making predictions for different query examples in parallelbinaryTransformationPtr – An unique pointer to an object of type
IBinaryTransformationthat should be used to transform aggregated scores into binary predictions or a null pointer, if all labels should be predicted as irrelevant
-
inline std::unique_ptr<DensePredictionMatrix<uint8>> predict(uint32 maxRules) const override¶
See also
IPredictor::predict
-
inline bool canPredictIncrementally() const override¶
See also
IPredictor::canPredictIncrementally
-
inline std::unique_ptr<IIncrementalPredictor<DensePredictionMatrix<uint8>>> createIncrementalPredictor(uint32 maxRules) const override¶
See also
IPredictor::createIncrementalPredictor
Private Members
-
const FeatureMatrix &featureMatrix_¶
-
const MultiThreadingSettings multiThreadingSettings_¶
-
const std::shared_ptr<IBinaryTransformation> binaryTransformationPtr_¶
-
class IncrementalPredictor : public AbstractIncrementalPredictor<FeatureMatrix, Model, DensePredictionMatrix<uint8>>¶
Public Functions
Protected Functions
-
inline DensePredictionMatrix<uint8> &applyNext(const FeatureMatrix &featureMatrix, MultiThreadingSettings multiThreadingSettings, typename Model::const_iterator rulesBegin, typename Model::const_iterator rulesEnd) override¶
Private Members
-
const std::shared_ptr<IBinaryTransformation> binaryTransformationPtr_¶
-
DensePredictionMatrix<float64> realMatrix_¶
-
DensePredictionMatrix<uint8> predictionMatrix_¶
-
class IncrementalPredictionDelegate : public PredictionDispatcher::IPredictionDelegate¶
Public Functions
-
inline IncrementalPredictionDelegate(CContiguousView<float64> &realMatrix, CContiguousView<uint8> &predictionMatrix, const IBinaryTransformation &binaryTransformation)¶
Private Members
-
CContiguousView<float64> &realMatrix_¶
-
CContiguousView<uint8> &predictionMatrix_¶
-
const IBinaryTransformation &binaryTransformation_¶
-
inline IncrementalPredictionDelegate(CContiguousView<float64> &realMatrix, CContiguousView<uint8> &predictionMatrix, const IBinaryTransformation &binaryTransformation)¶
-
inline DensePredictionMatrix<uint8> &applyNext(const FeatureMatrix &featureMatrix, MultiThreadingSettings multiThreadingSettings, typename Model::const_iterator rulesBegin, typename Model::const_iterator rulesEnd) override¶
-
class PredictionDelegate : public PredictionDispatcher::IPredictionDelegate¶
Public Functions
-
inline PredictionDelegate(CContiguousView<float64> &realMatrix, CContiguousView<uint8> &predictionMatrix, const IBinaryTransformation &binaryTransformation)¶
Private Members
-
CContiguousView<float64> &realMatrix_¶
-
CContiguousView<uint8> &predictionMatrix_¶
-
const IBinaryTransformation &binaryTransformation_¶
-
inline PredictionDelegate(CContiguousView<float64> &realMatrix, CContiguousView<uint8> &predictionMatrix, const IBinaryTransformation &binaryTransformation)¶
-
template<typename FeatureMatrix, typename Model>
class SparseBinaryPredictor : public ISparseBinaryPredictor¶ - #include <predictor_binary_common.hpp>
An implementation of the type
ISparseBinaryPredictorthat allows to predict sparse binary labels for given query examples by summing up the scores that are predicted by individual rules in a rule-based model and transforming the aggregated scores into binary predictions in {0, 1} according to anIBinaryTransformation.- 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 SparseBinaryPredictor(const FeatureMatrix &featureMatrix, const Model &model, uint32 numLabels, MultiThreadingSettings multiThreadingSettings, std::unique_ptr<IBinaryTransformation> binaryTransformationPtr)¶
- Parameters:
featureMatrix – A reference to an object of template type
FeatureMatrixthat provides row-wise access to the feature values of the query examplesmodel – A reference to an object of template type
Modelthat should be used to obtain predictionsnumLabels – The number of labels to predict for
multiThreadingSettings – An object of type
MultiThreadingSettingsthat stores settings to be used for making predictions for different query examples in parallelbinaryTransformationPtr – An unique pointer to an object of type
IBinaryTransformationthat should be used to transform real-valued predictions into binary predictions or a null pointer, if no such object is available
-
inline std::unique_ptr<BinarySparsePredictionMatrix> predict(uint32 maxRules) const override¶
See also
IPredictor::predict
-
inline bool canPredictIncrementally() const override¶
See also
IPredictor::canPredictIncrementally
-
inline std::unique_ptr<IIncrementalPredictor<BinarySparsePredictionMatrix>> createIncrementalPredictor(uint32 maxRules) const override¶
See also
IPredictor::createIncrementalPredictor
Private Members
-
const FeatureMatrix &featureMatrix_¶
-
const MultiThreadingSettings multiThreadingSettings_¶
-
const std::shared_ptr<IBinaryTransformation> binaryTransformationPtr_¶
-
class IncrementalPredictor : public AbstractIncrementalPredictor<FeatureMatrix, Model, BinarySparsePredictionMatrix>¶
Public Functions
Protected Functions
-
inline BinarySparsePredictionMatrix &applyNext(const FeatureMatrix &featureMatrix, MultiThreadingSettings multiThreadingSettings, typename Model::const_iterator rulesBegin, typename Model::const_iterator rulesEnd) override¶
Private Members
-
const std::shared_ptr<IBinaryTransformation> binaryTransformationPtr_¶
-
DensePredictionMatrix<float64> realMatrix_¶
-
BinaryLilMatrix predictionMatrix_¶
-
std::unique_ptr<BinarySparsePredictionMatrix> predictionMatrixPtr_¶
-
class IncrementalPredictionDelegate : public BinarySparsePredictionDispatcher::IPredictionDelegate¶
Public Functions
-
inline IncrementalPredictionDelegate(CContiguousView<float64> &realMatrix, BinaryLilMatrix &predictionMatrix, const IBinaryTransformation &binaryTransformation)¶
Private Members
-
CContiguousView<float64> &realMatrix_¶
-
BinaryLilMatrix &predictionMatrix_¶
-
const IBinaryTransformation &binaryTransformation_¶
-
inline IncrementalPredictionDelegate(CContiguousView<float64> &realMatrix, BinaryLilMatrix &predictionMatrix, const IBinaryTransformation &binaryTransformation)¶
-
inline BinarySparsePredictionMatrix &applyNext(const FeatureMatrix &featureMatrix, MultiThreadingSettings multiThreadingSettings, typename Model::const_iterator rulesBegin, typename Model::const_iterator rulesEnd) override¶
-
class PredictionDelegate : public BinarySparsePredictionDispatcher::IPredictionDelegate¶
Public Functions
-
inline PredictionDelegate(CContiguousView<float64> &realMatrix, BinaryLilMatrix &predictionMatrix, const IBinaryTransformation &binaryTransformation)¶
Private Members
-
CContiguousView<float64> &realMatrix_¶
-
BinaryLilMatrix &predictionMatrix_¶
-
const IBinaryTransformation &binaryTransformation_¶
-
inline PredictionDelegate(CContiguousView<float64> &realMatrix, BinaryLilMatrix &predictionMatrix, const IBinaryTransformation &binaryTransformation)¶
-
template<typename FeatureMatrix, typename Model>