File learner_regression.hpp¶
-
class IRegressionRuleLearner¶
- #include <learner_regression.hpp>
Defines an interface for all rule learners that can be applied to regression problems.
Subclassed by AbstractRegressionRuleLearner
Public Functions
-
inline virtual ~IRegressionRuleLearner()¶
-
virtual std::unique_ptr<ITrainingResult> fit(const IExampleWeights &exampleWeights, const IFeatureInfo &featureInfo, const IColumnWiseFeatureMatrix &featureMatrix, const IRowWiseRegressionMatrix ®ressionMatrix) const = 0¶
Applies the rule learner to given training examples and corresponding ground truth regression scores.
- 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 examplesregressionMatrix – A reference to an object of type
IRowWiseRegressionMatrixthat provides row-wise access to the ground truth regression scores 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 numOutputs) 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 examplesnumOutputs – The number of outputs 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 numOutputs) 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 predictionsnumOutputs – The number of outputs 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 ~IRegressionRuleLearner()¶