File refinement_comparator_fixed.hpp¶
-
class FixedRefinementComparator¶
- #include <refinement_comparator_fixed.hpp>
Allows comparing potential refinements of a rule and keeping track of the best ones.
Public Types
-
using iterator = std::vector<std::reference_wrapper<Refinement>>::iterator¶
An iterator that provides access to the refinements the comparator keeps track of and allows to modify them.
Public Functions
-
FixedRefinementComparator(RuleCompareFunction ruleCompareFunction, uint32 maxRefinements, const Quality &minQuality)¶
- Parameters:
ruleCompareFunction – An object of type
RuleCompareFunctionthat defines the function that should be used for comparing the quality of different rulesmaxRefinements – The maximum number of refinements to keep track of
minQuality – A reference to an object of type
Qualitya refinement must improve on
-
FixedRefinementComparator(RuleCompareFunction ruleCompareFunction, uint32 maxRefinements)¶
- Parameters:
ruleCompareFunction – An object of type
RuleCompareFunctionthat defines the function that should be used for comparing the quality of different rulesmaxRefinements – The maximum number of refinements to keep track of
-
FixedRefinementComparator(const FixedRefinementComparator &comparator)¶
- Parameters:
comparator – A reference to an object of type
FixedRefinementComparatorthat keeps track of the best refinements found so far
-
~FixedRefinementComparator()¶
-
iterator begin()¶
Returns an
iteratorto the beginning of the refinements, starting with the best one.- Returns:
An
iteratorto the beginning
-
uint32 getNumElements() const¶
Returns the number of refinements the comparator keeps track of.
- Returns:
The number of refinements
-
bool isImprovement(const Quality &quality) const¶
Returns whether the quality of a rule’s predictions is considered as an improvement over the quality of the refinements that have been provided to this comparator so far.
- Parameters:
quality – A reference to an object of type
Qualitythat stores the quality of the predictions- Returns:
True, if the given quality is considered as an improvement, false otherwise
-
void pushRefinement(const Refinement &refinement, const IStatisticsUpdateCandidate &scores)¶
Keeps track of a given refinement of a rule that is considered as an improvement over the refinements that have been provided to this comparator so far.
- Parameters:
refinement – A reference to an object of type
Refinementthat represents the refinement of the rulescores – A reference to an object of type
IStatisticsUpdateCandidatethat stores the predictions of the rule
-
bool merge(FixedRefinementComparator &comparator)¶
Keeps track of the best refinements that are stored by a given
FixedRefinementComparatorif they are considered as an improvement over the best refinements that have been provided to this comparator.- Parameters:
comparator – A reference to an object of type
FixedRefinementComparatorthat should be merged- Returns:
True, if at least one of the refinements that are stored by the given
comparatoris considered as an improvement over the best refinements that has been provided to this comparator
Private Members
-
const RuleCompareFunction ruleCompareFunction_¶
-
Refinement *refinements_¶
-
std::vector<std::reference_wrapper<Refinement>> order_¶
-
using iterator = std::vector<std::reference_wrapper<Refinement>>::iterator¶