File learner_classification.hpp¶
-
class IClassificationRuleLearner¶
- #include <learner_classification.hpp>
Defines an interface for all rule learners that can be applied to classification problems.
Subclassed by AbstractClassificationRuleLearner
Public Functions
-
inline virtual ~IClassificationRuleLearner()¶
-
virtual std::unique_ptr<ITrainingResult> fit(const IExampleWeights &exampleWeights, const IFeatureInfo &featureInfo, const IColumnWiseFeatureMatrix &featureMatrix, const IRowWiseLabelMatrix &labelMatrix) const = 0¶
Applies the rule learner to given training examples and corresponding ground truth labels.
- Parameters:
exampleWeights – A reference to an object of type
IExampleWeightsthat provides access to the weights of the training examplesfeatureInfo – A reference to an object of type
IFeatureInfothat provides information about the types of individual featuresfeatureMatrix – A reference to an object of type
IColumnWiseFeatureMatrixthat provides column-wise access to the feature values of the training exampleslabelMatrix – A reference to an object of type
IRowWiseLabelMatrixthat provides row-wise access to the ground truth labels of the training examples
- Returns:
An unique pointer to an object of type
ITrainingResultthat provides access to the results of fitting the rule learner to the training data
-
inline virtual bool canPredictScores(const IRowWiseFeatureMatrix &featureMatrix, const ITrainingResult &trainingResult) const¶
Returns whether the rule learner is able to predict scores or not.
- Parameters:
featureMatrix – A reference to an object of type
IRowWiseFeatureMatrixthat provides row-wise access to the feature values of the query examplestrainingResult – A reference to an object of type
ITrainingResultthat provides access to the model and additional information that should be used to obtain predictions
- Returns:
True, if the rule learner is able to predict scores, false otherwise
-
virtual bool canPredictScores(const IRowWiseFeatureMatrix &featureMatrix, uint32 numLabels) const = 0¶
Returns whether the rule learner is able to predict scores or not.
- Parameters:
featureMatrix – A reference to an object of type
IRowWiseFeatureMatrixthat provides row-wise access to the feature values of the query examplesnumLabels – The number of labels to predict for
- Returns:
True, if the rule learner is able to predict scores, false otherwise
-
inline virtual std::unique_ptr<IScorePredictor> createScorePredictor(const IRowWiseFeatureMatrix &featureMatrix, const ITrainingResult &trainingResult) const¶
Creates and returns a predictor that may be used to predict scores for given query examples. If the prediction of scores is not supported by the rule learner, a
std::runtime_erroris thrown.- Throws:
std::runtime_exception – The exception that is thrown if the prediction of scores is not supported by the rule learner
- Parameters:
featureMatrix – A reference to an object of type
IRowWiseFeatureMatrixthat provides row-wise access to the feature values of the query examplestrainingResult – A reference to an object of type
ITrainingResultthat provides access to the model and additional information that should be used to obtain predictions
- Returns:
An unique pointer to an object of type
IScorePredictorthat may be used to predict scores for the given query examples
-
virtual std::unique_ptr<IScorePredictor> createScorePredictor(const IRowWiseFeatureMatrix &featureMatrix, const IRuleModel &ruleModel, const IOutputSpaceInfo &outputSpaceInfo, uint32 numLabels) const = 0¶
Creates and returns a predictor that may be used to predict scores for given query examples. If the prediction of scores is not supported by the rule learner, a
std::runtime_erroris thrown.- Throws:
std::runtime_exception – The exception that is thrown if the prediction of scores is not supported by the rule learner
- Parameters:
featureMatrix – A reference to an object of type
IRowWiseFeatureMatrixthat provides row-wise access to the feature values of the query examplesruleModel – A reference to an object of type
IRuleModelthat should be used to obtain predictionsoutputSpaceInfo – A reference to an object of type
IOutputSpaceInfothat provides information about the output space that may be used as a basis for obtaining predictionsnumLabels – The number of labels to predict for
- Returns:
An unique pointer to an object of type
IScorePredictorthat may be used to predict scores for the given query examples
-
inline virtual bool canPredictProbabilities(const IRowWiseFeatureMatrix &featureMatrix, const ITrainingResult &trainingResult) const¶
Returns whether the rule learner is able to predict probabilities or not.
- Parameters:
featureMatrix – A reference to an object of type
IRowWiseFeatureMatrixthat provides row-wise access to the feature values of the query examplestrainingResult – A reference to an object of type
ITrainingResultthat provides access to the model and additional information that should be used to obtain predictions
- Returns:
True, if the rule learner is able to predict probabilities, false otherwise
-
virtual bool canPredictProbabilities(const IRowWiseFeatureMatrix &featureMatrix, uint32 numLabels) const = 0¶
Returns whether the rule learner is able to predict probabilities or not.
- Parameters:
featureMatrix – A reference to an object of type
IRowWiseFeatureMatrixthat provides row-wise access to the feature values of the query examplesnumLabels – The number of labels to predict for
- Returns:
True, if the rule learner is able to predict probabilities, false otherwise
-
inline virtual std::unique_ptr<IProbabilityPredictor> createProbabilityPredictor(const IRowWiseFeatureMatrix &featureMatrix, const ITrainingResult &trainingResult) const¶
Creates and returns a predictor that may be used to predict probability estimates for given query examples. If the prediction of probability estimates is not supported by the rule learner, a
std::runtime_erroris thrown.- Throws:
std::runtime_exception – The exception that is thrown if the prediction of probability estimates is not supported by the rule learner
- Parameters:
featureMatrix – A reference to an object of type
IRowWiseFeatureMatrixthat provides row-wise access to the feature values of the query examplestrainingResult – A reference to an object of type
ITrainingResultthat provides access to the model and additional information that should be used to obtain predictions
- Returns:
An unique pointer to an object of type
IProbabilityPredictorthat may be used to predict probability estimates for the given query examples
-
virtual std::unique_ptr<IProbabilityPredictor> createProbabilityPredictor(const IRowWiseFeatureMatrix &featureMatrix, const IRuleModel &ruleModel, const IOutputSpaceInfo &outputSpaceInfo, const IMarginalProbabilityCalibrationModel &marginalProbabilityCalibrationModel, const IJointProbabilityCalibrationModel &jointProbabilityCalibrationModel, uint32 numLabels) const = 0¶
Creates and returns a predictor that may be used to predict probability estimates for given query examples. If the prediction of probability estimates is not supported by the rule learner, a
std::runtime_erroris thrown.- Throws:
std::runtime_exception – The exception that is thrown if the prediction of probability estimates is not supported by the rule learner
- Parameters:
featureMatrix – A reference to an object of type
IRowWiseFeatureMatrixthat provides row-wise access to the feature values of the query examplesruleModel – A reference to an object of type
IRuleModelthat should be used to obtain predictionsoutputSpaceInfo – A reference to an object of type
IOutputSpaceInfothat provides information about the output space that may be used as a basis for obtaining predictionsmarginalProbabilityCalibrationModel – A reference to an object of type
IMarginalProbabilityCalibrationModelthat may be used for the calibration of marginal probabilitiesjointProbabilityCalibrationModel – A reference to an object of type
IJointProbabilityCalibrationModelthat may be used for the calibration of joint probabilitiesnumLabels – The number of labels to predict for
- Returns:
An unique pointer to an object of type
IProbabilityPredictorthat may be used to predict probability estimates for the given query examples
-
inline virtual bool canPredictBinary(const IRowWiseFeatureMatrix &featureMatrix, const ITrainingResult &trainingResult) const¶
Returns whether the rule learner is able to predict binary labels or not.
- Parameters:
featureMatrix – A reference to an object of type
IRowWiseFeatureMatrixthat provides row-wise access to the feature values of the query examplestrainingResult – A reference to an object of type
ITrainingResultthat provides access to the model and additional information that should be used to obtain predictions
- Returns:
True, if the rule learner is able to predict binary labels, false otherwise
-
virtual bool canPredictBinary(const IRowWiseFeatureMatrix &featureMatrix, uint32 numLabels) const = 0¶
Returns whether the rule learner is able to predict binary labels or not.
- Parameters:
featureMatrix – A reference to an object of type
IRowWiseFeatureMatrixthat provides row-wise access to the feature values of the query examplesnumLabels – The number of labels to predict for
- Returns:
True, if the rule learner is able to predict binary labels, false otherwise
-
inline virtual std::unique_ptr<IBinaryPredictor> createBinaryPredictor(const IRowWiseFeatureMatrix &featureMatrix, const ITrainingResult &trainingResult) const¶
Creates and returns a predictor that may be used to predict binary labels for given query examples. If the prediction of binary labels is not supported by the rule learner, a
std::runtime_erroris thrown.- Throws:
std::runtime_exception – The exception that is thrown if the prediction of binary labels is not supported by the rule learner
- Parameters:
featureMatrix – A reference to an object of type
IRowWiseFeatureMatrixthat provides row-wise access to the feature values of the query examplestrainingResult – A reference to an object of type
ITrainingResultthat provides access to the model and additional information that should be used to obtain predictions
- Returns:
An unique pointer to an object of type
IBinaryPredictorthat may be used to predict binary labels for the given query examples
-
virtual std::unique_ptr<IBinaryPredictor> createBinaryPredictor(const IRowWiseFeatureMatrix &featureMatrix, const IRuleModel &ruleModel, const IOutputSpaceInfo &outputSpaceInfo, const IMarginalProbabilityCalibrationModel &marginalProbabilityCalibrationModel, const IJointProbabilityCalibrationModel &jointProbabilityCalibrationModel, uint32 numLabels) const = 0¶
Creates and returns a predictor that may be used to predict binary labels for given query examples. If the prediction of binary labels is not supported by the rule learner, a
std::runtime_erroris thrown.- Throws:
std::runtime_exception – The exception that is thrown if the prediction of binary labels is not supported by the rule learner
- Parameters:
featureMatrix – A reference to an object of type
IRowWiseFeatureMatrixthat provides row-wise access to the feature values of the query examplesruleModel – A reference to an object of type
IRuleModelthat should be used to obtain predictionsoutputSpaceInfo – A reference to an object of type
IOutputSpaceInfothat provides information about the output space that may be used as a basis for obtaining predictionsmarginalProbabilityCalibrationModel – A reference to an object of type
IMarginalProbabilityCalibrationModelthat may be used for the calibration of marginal probabilitiesjointProbabilityCalibrationModel – A reference to an object of type
IJointProbabilityCalibrationModelthat may be used for the calibration of joint probabilitiesnumLabels – The number of labels to predict for
- Returns:
An unique pointer to an object of type
IBinaryPredictorthat may be used to predict binary labels for the given query examples
-
inline virtual std::unique_ptr<ISparseBinaryPredictor> createSparseBinaryPredictor(const IRowWiseFeatureMatrix &featureMatrix, const ITrainingResult &trainingResult) const¶
Creates and returns a predictor that may be used to predict sparse binary labels for given query examples. If the prediction of sparse binary labels is not supported by the rule learner, a
std::runtime_erroris thrown.- Throws:
std::runtime_exception – The exception that is thrown if the prediction of sparse binary labels is not supported by the rule learner
- Parameters:
featureMatrix – A reference to an object of type
IRowWiseFeatureMatrixthat provides row-wise access to the feature values of the query examplestrainingResult – A reference to an object of type
ITrainingResultthat provides access to the model and additional information that should be used to obtain predictions
- Returns:
An unique pointer to an object of type
ISparseBinaryPredictorthat may be used to predict sparse binary labels for the given query examples
-
virtual std::unique_ptr<ISparseBinaryPredictor> createSparseBinaryPredictor(const IRowWiseFeatureMatrix &featureMatrix, const IRuleModel &ruleModel, const IOutputSpaceInfo &outputSpaceInfo, const IMarginalProbabilityCalibrationModel &marginalProbabilityCalibrationModel, const IJointProbabilityCalibrationModel &jointProbabilityCalibrationModel, uint32 numLabels) const = 0¶
Creates and returns a predictor that may be used to predict sparse binary labels for given query examples. If the prediction of sparse binary labels is not supported by the rule learner, a
std::runtime_erroris thrown.- Throws:
std::runtime_exception – The exception that is thrown if the prediction of sparse binary labels is not supported by the rule learner
- Parameters:
featureMatrix – A reference to an object of type
IRowWiseFeatureMatrixthat provides row-wise access to the feature values of the query examplesruleModel – A reference to an object of type
IRuleModelthat should be used to obtain predictionsoutputSpaceInfo – A reference to an object of type
IOutputSpaceInfothat provides information about the output space that may be used as a basis for obtaining predictionsmarginalProbabilityCalibrationModel – A reference to an object of type
IMarginalProbabilityCalibrationModelthat may be used for the calibration of marginal probabilitiesjointProbabilityCalibrationModel – A reference to an object of type
IJointProbabilityCalibrationModelthat may be used for the calibration of joint probabilitiesnumLabels – The number of labels to predict for
- Returns:
An unique pointer to an object of type
ISparseBinaryPredictorthat may be used to predict sparse binary labels for the given query examples
-
inline virtual ~IClassificationRuleLearner()¶
-
class IOutputWiseStratifiedInstanceSamplingMixin : public virtual IRuleLearnerConfig¶
- #include <learner_classification.hpp>
Defines an interface for all classes that allow to configure a rule learner to use label-wise stratified instance sampling.
Public Functions
-
inline virtual ~IOutputWiseStratifiedInstanceSamplingMixin() override¶
-
inline virtual IOutputWiseStratifiedInstanceSamplingConfig &useOutputWiseStratifiedInstanceSampling()¶
Configures the rule learner to sample from the available training examples using stratification, such that for each label the proportion of relevant and irrelevant examples is maintained, whenever a new rule should be learned.
- Returns:
A reference to an object of type
IOutputWiseStratifiedInstanceSamplingConfigthat allows further configuration of the method for sampling instances
-
inline virtual ~IOutputWiseStratifiedInstanceSamplingMixin() override¶
-
class IExampleWiseStratifiedInstanceSamplingMixin : public virtual IRuleLearnerConfig¶
- #include <learner_classification.hpp>
Defines an interface for all classes that allow to configure a rule learner to use example-wise stratified instance sampling.
Public Functions
-
inline virtual ~IExampleWiseStratifiedInstanceSamplingMixin() override¶
-
inline virtual IExampleWiseStratifiedInstanceSamplingConfig &useExampleWiseStratifiedInstanceSampling()¶
Configures the rule learner to sample from the available training examples using stratification, where distinct label vectors are treated as individual classes, whenever a new rule should be learned.
- Returns:
A reference to an object of type
IExampleWiseStratifiedInstanceSamplingConfigthat allows further configuration of the method for sampling instances
-
inline virtual ~IExampleWiseStratifiedInstanceSamplingMixin() override¶
-
class IOutputWiseStratifiedBiPartitionSamplingMixin : public virtual IRuleLearnerConfig¶
- #include <learner_classification.hpp>
Defines an interface for all classes that allow to configure a rule learner to partition the available training examples into a training set and a holdout set using stratification, such that for each label the proportion of relevant and irrelevant examples is maintained.
Public Functions
-
inline virtual ~IOutputWiseStratifiedBiPartitionSamplingMixin() override¶
-
inline virtual IOutputWiseStratifiedBiPartitionSamplingConfig &useOutputWiseStratifiedBiPartitionSampling()¶
Configures the rule learner to partition the available training examples into a training set and a holdout set using stratification, such that for each label the proportion of relevant and irrelevant examples is maintained.
- Returns:
A reference to an object of type
IOutputWiseStratifiedBiPartitionSamplingConfigthat allows further configuration of the method for partitioning the available training examples into a training and a holdout set
-
inline virtual ~IOutputWiseStratifiedBiPartitionSamplingMixin() override¶
-
class IExampleWiseStratifiedBiPartitionSamplingMixin : public virtual IRuleLearnerConfig¶
- #include <learner_classification.hpp>
Defines an interface for all classes that allow to configure a rule learner to partition the available training examples into a training set and a holdout set using stratification, where distinct label vectors are treated as individual classes.
Public Functions
-
inline virtual ~IExampleWiseStratifiedBiPartitionSamplingMixin() override¶
-
inline virtual IExampleWiseStratifiedBiPartitionSamplingConfig &useExampleWiseStratifiedBiPartitionSampling()¶
Configures the rule learner to partition the available training examples into a training set and a holdout set using stratification, where distinct label vectors are treated as individual classes.
- Returns:
A reference to an object of type
IExampleWiseStratifiedBiPartitionSamplingConfigthat allows further configuration of the method for partitioning the available training examples into a training and a holdout set
-
inline virtual ~IExampleWiseStratifiedBiPartitionSamplingMixin() override¶