File rule_refinement_feature_based.hpp

template<typename IndexVector>
class FeatureBasedRuleRefinement : public IRuleRefinement
#include <rule_refinement_feature_based.hpp>

Allows to find the best refinements of existing rules, which result from adding a new condition that correspond to a certain feature. The thresholds that may be used by the new condition result from the feature values of all training examples for the respective feature.

Template Parameters:

IndexVector – The type of the vector that provides access to the indices of the labels for which the refined rule is allowed to predict

Public Functions

FeatureBasedRuleRefinement(const IndexVector &labelIndices, uint32 featureIndex, uint32 numExamplesWithNonZeroWeights, std::unique_ptr<IRuleRefinement::ICallback> callbackPtr)
Parameters:
  • labelIndices – A reference to an object of template type IndexVector that provides access to the indices of the labels for which the refined rule is allowed to predict

  • featureIndex – The index of the feature, the new condition corresponds to

  • numExamplesWithNonZeroWeights – The total number of examples with non-zero weights that may be covered by a refinement

  • callbackPtr – An unique pointer to an object of type IRuleRefinement::ICallback that allows to retrieve the information that is required to search for potential refinements

virtual void findRefinement(SingleRefinementComparator &comparator, uint32 minCoverage) const override

Finds the best refinement of an existing rule.

Parameters:
  • comparator – A reference to an object of type SingleRefinementComparator that should be used for comparing potential refinements

  • minCoverage – The minimum number of examples that must be covered by the refinement

virtual void findRefinement(FixedRefinementComparator &comparator, uint32 minCoverage) const override

Finds the best refinements of an existing rule.

Parameters:
  • comparator – A reference to an object of type MultiRefinementComparator that should be used for comparing potential refinements

  • minCoverage – The minimum number of examples that must be covered by the refinements

Private Members

const IndexVector &labelIndices_
const uint32 featureIndex_
const uint32 numExamplesWithNonZeroWeights_
const std::unique_ptr<IRuleRefinement::ICallback> callbackPtr_