File feature_subspace.hpp¶
-
class IFeatureSubspace¶
- #include <feature_subspace.hpp>
Defines an interface for all classes that provide access to 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<ICallback> createCallback(uint32 featureIndex) = 0¶
Creates and returns a new instance of the type
ICallbackthat allows to retrieve information that is required to search for the best refinement of a rule that covers all examples included in this subspace.- Parameters:
featureIndex – The index of the feature that should be considered when searching for refinements
- Returns:
An unique pointer to an object of type
ICallbackthat has been created
-
virtual void filterSubspace(const Condition &condition) = 0¶
Filters the subspace such that it only includes those training examples that satisfy 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 uint32 getNumCovered() const = 0¶
Returns the number of training examples with non-zero weights that are included in this subspace.
- Returns:
The number of training examples included in this subspace
-
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, std::unique_ptr<IEvaluatedPrediction> &headPtr) 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 ruleheadPtr – A reference to an unique pointer that stores an object of type
IEvaluatedPredictionto be updated
-
virtual void recalculatePrediction(const BiPartition &partition, const CoverageMask &coverageMask, std::unique_ptr<IEvaluatedPrediction> &headPtr) 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 ruleheadPtr – A reference to an unique pointer that stores an object of type
IEvaluatedPredictionto be updated
-
virtual void applyPrediction(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(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
-
class ICallback¶
- #include <feature_subspace.hpp>
Defines an interface for callbacks that may be invoked in order to retrieve the information that is required to search for potential refinements of a rule. It consists of
IWeightedStatistics, as well as anIFeatureVectorthat allows to determine the thresholds that may be used by potential conditions.Public Functions
-
inline virtual ~ICallback()¶
-
struct Result¶
- #include <feature_subspace.hpp>
The data that is provided via the callback’s
getfunction.Public Functions
-
inline Result(const IWeightedStatistics &statistics, const IFeatureVector &featureVector)¶
- Parameters:
statistics – A reference to an object of type
IWeightedStatisticsthat should be used to search for potential refinementsfeatureVector – A reference to an object of type
IFeatureVectorthat should be used to search for potential refinements
Public Members
-
const IWeightedStatistics &statistics¶
A reference to an object of type
IWeightedStatisticsthat should be used to search for potential refinements.
-
const IFeatureVector &featureVector¶
A reference to an object of type
IFeatureVectorthat should be used to search for potential refinements.
-
inline Result(const IWeightedStatistics &statistics, const IFeatureVector &featureVector)¶
-
inline virtual ~ICallback()¶
-
inline virtual ~IFeatureSubspace()¶