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

typedef std::vector<std::reference_wrapper<Refinement>>::iterator 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 RuleCompareFunction that defines the function that should be used for comparing the quality of different rules

  • maxRefinements – The maximum number of refinements to keep track of

  • minQuality – A reference to an object of type Quality a refinement must improve on

FixedRefinementComparator(RuleCompareFunction ruleCompareFunction, uint32 maxRefinements)
Parameters:
  • ruleCompareFunction – An object of type RuleCompareFunction that defines the function that should be used for comparing the quality of different rules

  • maxRefinements – The maximum number of refinements to keep track of

FixedRefinementComparator(const FixedRefinementComparator &comparator)
Parameters:

comparator – A reference to an object of type FixedRefinementComparator that keeps track of the best refinements found so far

~FixedRefinementComparator()
iterator begin()

Returns an iterator to the beginning of the refinements, starting with the best one.

Returns:

An iterator to the beginning

iterator end()

Returns an `iterator to the end of the refinements.

Returns:

An iterator to the end

uint32 getNumElements() const

Returns the number of refinements the comparator keeps track of.

Returns:

The number of refinements

bool isImprovement(const IScoreVector &scoreVector) 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:

scoreVector – A reference to an object of type IScoreVector that stores the quality of the predictions

Returns:

True, if the quality of the given predictions is considered as an improvement, false otherwise

void pushRefinement(const Refinement &refinement, const IScoreVector &scoreVector)

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 Refinement that represents the refinement of the rule

  • scoreVector – A reference to an object of type IScoreVector that stores the predictions of the rule

bool merge(FixedRefinementComparator &comparator)

Keeps track of the best refinements that are stored by a given FixedRefinementComparator if 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 FixedRefinementComparator that should be merged

Returns:

True, if at least one of the refinements that are stored by the given comparator is considered as an improvement over the best refinements that has been provided to this comparator

Private Members

const RuleCompareFunction ruleCompareFunction_
const uint32 maxRefinements_
Refinement *refinements_
std::vector<std::reference_wrapper<Refinement>> order_
Quality minQuality_