File feature_subspace.hpp¶
-
class IFeatureSubspace¶
- #include <feature_subspace.hpp>
Defines an interface for all classes that provide access a subspace of the feature space that includes the training examples covered by a rule.
Public Functions
-
inline virtual ~IFeatureSubspace()¶
-
virtual std::unique_ptr<IFeatureSubspace> copy() const = 0¶
Creates and returns a copy of this object.
- Returns:
An unique pointer to an object of type
IFeatureSubspacethat has been created
-
virtual std::unique_ptr<IRuleRefinement> createRuleRefinement(const CompleteIndexVector &outputIndices, uint32 featureIndex) = 0¶
Creates and returns a new instance of the type
IRuleRefinementthat allows to find the best refinement of a rule that covers all examples included in this subspace and predicts for all available outputs.- Parameters:
outputIndices – A reference to an object of type
CompleteIndexVectorthat provides access to the indices of the outputs for which the existing rule predictsfeatureIndex – The index of the feature that should be considered when searching for refinements
- Returns:
An unique pointer to an object of type
IRuleRefinementthat has been created
-
virtual std::unique_ptr<IRuleRefinement> createRuleRefinement(const PartialIndexVector &outputIndices, uint32 featureIndex) = 0¶
Creates and returns a new instance of the type
IRuleRefinementthat allows to find the best refinement of a rule that covers all examples included in this subspace and predicts for a subset of the available outputs.- Parameters:
outputIndices – A reference to an object of type
PartialIndexVectorthat provides access to the indices of the outputs for which the existing rule predictsfeatureIndex – The index of the feature that should be considered when searching for refinements
- Returns:
An unique pointer to an object of type
IRuleRefinementthat has been created
-
virtual void filterSubspace(const Condition &condition) = 0¶
Filters the subspace such that it only includes those training examples that statisfy a specific condition.
- Parameters:
condition – A reference to an object of type
Condition
-
virtual void resetSubspace() = 0¶
Resets the subspace. This reverts the effects of all previous calls to the function
filterSubspace.
-
virtual const CoverageMask &getCoverageMask() const = 0¶
Returns an object of type
CoverageMaskthat keeps track of the training examples that are included in this subspace.- Returns:
A reference to an object of type
CoverageMaskthat keeps track of the training examples that are included in this subspace
-
virtual Quality evaluateOutOfSample(const SinglePartition &partition, const CoverageMask &coverageMask, const IPrediction &head) const = 0¶
Calculates and returns a numerical score that assesses the quality of a rule’s prediction for all examples that do not belong to the current instance sub-sample and are marked as covered according to a given
CoverageMask.For calculating the quality, only examples that belong to the training set and are not included in the current instance sub-sample, i.e., only examples with zero weights, are considered and assigned equally distributed weights.
- Parameters:
partition – A reference to an object of type
SinglePartitionthat provides access to the indices of the training examples that belong to the training setcoverageMask – A reference to an object of type
CoverageMaskthat keeps track of the examples that are covered by the rulehead – A reference to an object of type
IPredictionthat stores the scores that are predicted by the rule
- Returns:
An object of type
Qualitythat stores the calculated quality
-
virtual Quality evaluateOutOfSample(const BiPartition &partition, const CoverageMask &coverageMask, const IPrediction &head) const = 0¶
Calculates and returns a numerical score that assesses the quality of a rule’s prediction for all examples that do not belong to the current instance sub-sample and are marked as covered according to a given
CoverageMask.For calculating the quality, only examples that belong to the training set and are not included in the current instance sub-sample, i.e., only examples with zero weights, are considered and assigned equally distributed weights.
- Parameters:
partition – A reference to an object of type
BiPartitionthat provides access to the indices of the training examples that belong to the training setcoverageMask – A reference to an object of type
CoverageMaskthat keeps track of the examples that are covered by the rulehead – A reference to an object of type
IPredictionthat stores the scores that are predicted by the rule
- Returns:
An object of type
Qualitythat stores the calculated quality
-
virtual void recalculatePrediction(const SinglePartition &partition, const CoverageMask &coverageMask, IPrediction &head) const = 0¶
Recalculates and updates a rule’s prediction based on all examples in the training set that are marked as covered according to a given
CoverageMask.When calculating the updated prediction, the weights of the individual training examples are ignored and equally distributed weights are used instead.
- Parameters:
partition – A reference to an object of type
SinglePartitionthat provides access to the indices of the training examples that belong to the training setcoverageMask – A reference to an object of type
CoverageMaskthat keeps track of the examples that are covered by the rulehead – A reference to an object of type
IPredictionto be updated
-
virtual void recalculatePrediction(const BiPartition &partition, const CoverageMask &coverageMask, IPrediction &head) const = 0¶
Recalculates and updates a rule’s prediction based on all examples in the training set that are marked as covered according to a given
CoverageMask.When calculating the updated prediction, the weights of the individual training examples are ignored and equally distributed weights are used instead.
- Parameters:
partition – A reference to an object of type
BiPartitionthat provides access to the indices of the training examples that belong to the training setcoverageMask – A reference to an object of type
CoverageMaskthat keeps track of the examples that are covered by the rulehead – A reference to an object of type
IPredictionto be updated
-
virtual void applyPrediction(const IPrediction &prediction) = 0¶
Updates the statistics that correspond to the training examples included in this subspace based on the prediction of a rule.
- Parameters:
prediction – A reference to an object of type
IPredictionthat stores the prediction of the rule
-
virtual void revertPrediction(const IPrediction &prediction) = 0¶
Reverts the statistics that correspond to the training examples included in this subspace based on the predictions of a rule.
- Parameters:
prediction – A reference to an object of type
IPredictionthat stores the prediction of the rule
-
inline virtual ~IFeatureSubspace()¶