File model_builder_intermediate.hpp¶
-
class IntermediateModelBuilder : public IModelBuilder¶
- #include <model_builder_intermediate.hpp>
An implementation of the class
IModelBuilder
that stores intermediate representations of rules, which can still be modified when globally optimizing a rule-based model once it has been learned, that are ultimately converted into a final model using anotherIModelBuilder
.Public Types
-
typedef std::pair<std::unique_ptr<ConditionList>, std::unique_ptr<IEvaluatedPrediction>> IntermediateRule¶
The type of a rule, which can still be modified.
-
typedef std::vector<IntermediateRule>::iterator iterator¶
An iterator that provides access to the intermediate representations of rules and allows to modify them.
Public Functions
-
IntermediateModelBuilder(std::unique_ptr<IModelBuilder> modelBuilderPtr)¶
- Parameters:
modelBuilderPtr – An unique pointer to an object of type
IModelBuilder
that should be used to build the final model
-
iterator begin()¶
Returns an
iterator
to the beginning of the intermediate representations of rules.- Returns:
An
iterator
to the beginning
-
iterator end()¶
Returns an
iterator
to the end of the intermediate representations of rules.- Returns:
An
iterator
to the end
-
void removeLastRule()¶
Removes the intermediate representation of the last rule.
-
virtual void setNumUsedRules(uint32 numUsedRules) override¶
Sets the number of used rules.
- Parameters:
numUsedRules – The number of used rules
-
virtual void setDefaultRule(std::unique_ptr<IEvaluatedPrediction> &predictionPtr) override¶
Sets the default rule of the model.
- Parameters:
predictionPtr – A reference to an unique pointer of type
IEvaluatedPrediction
that stores the scores that are predicted by the default rule
-
virtual void addRule(std::unique_ptr<ConditionList> &conditionListPtr, std::unique_ptr<IEvaluatedPrediction> &predictionPtr) override¶
Adds a new rule to the model.
- Parameters:
conditionListPtr – A reference to an unique pointer of type
ConditionList
that stores the rule’s conditionspredictionPtr – A reference to an unique pointer of type
IEvaluatedPrediction
that stores the scores that are predicted by the rule
-
virtual std::unique_ptr<IRuleModel> buildModel() override¶
Builds and returns the model.
- Returns:
An unique pointer to an object of type
IRuleModel
that has been built
Private Members
-
const std::unique_ptr<IModelBuilder> modelBuilderPtr_¶
-
std::unique_ptr<IEvaluatedPrediction> defaultPredictionPtr_¶
-
std::vector<IntermediateRule> intermediateRuleList_¶
-
typedef std::pair<std::unique_ptr<ConditionList>, std::unique_ptr<IEvaluatedPrediction>> IntermediateRule¶