File refinement_comparator_single.hpp

class SingleRefinementComparator
#include <refinement_comparator_single.hpp>

Allows comparing potential refinements of a rule and keeping track of the best one.

Public Types

using iterator = Refinement*

An iterator that provides access to the refinements the comparator keeps track of and allows to modify them.

Public Functions

SingleRefinementComparator(RuleCompareFunction ruleCompareFunction)
Parameters:

ruleCompareFunction – An object of type RuleCompareFunction that defines the function that should be used for comparing the quality of different rules

SingleRefinementComparator(const SingleRefinementComparator &comparator)
Parameters:

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

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 Quality &quality) const

Returns whether the quality of a rule’s predictions is considered as an improvement over the refinements that have been provided to this comparator so far.

Parameters:

quality – A reference to an object of type Quality that 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 Refinement that represents the refinement of the rule

  • scores – A reference to an object of type IStatisticsUpdateCandidate that stores the predictions of the rule

bool merge(SingleRefinementComparator &comparator)

Keeps track of the best refinement that is stored by a given SingleRefinementComparator if it is considered as an improvement over the best refinement that has been provided to this comparator.

Parameters:

comparator – A reference to an object of type SingleRefinementComparator that should be merged

Returns:

True, if the best refinement that is stored by the given comparator is considered as an improvement over the best refinement that has been provided to this comparator

Private Members

const RuleCompareFunction ruleCompareFunction_
Refinement bestRefinement_
Quality bestQuality_
ScoreProcessor scoreProcessor_