Abstract base of the feature-ranking methods: scores features one by one, then turns the ranking into a feature subset.
More...
|
|
typedef Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > | parent |
| | the abstract Search interface this class implements
|
|
typedef std::shared_ptr< CRITERION > | PCriterion |
| | shared pointer to the criterion the search optimizes
|
|
typedef std::shared_ptr< SUBSET > | PSubset |
| | shared pointer to a feature subset
|
|
typedef Candidate_Evaluator< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > | EVALUATORENGINE |
| | the injected candidate-evaluation engine interface driving individual-feature evaluation
|
| typedef std::shared_ptr< EVALUATORENGINE > | PEvaluatorEngine |
|
typedef std::shared_ptr< CRITERION > | PCriterion |
| | shared pointer to the criterion the search optimizes
|
|
typedef std::shared_ptr< SUBSET > | PSubset |
| | shared pointer to a feature subset
|
|
typedef std::shared_ptr< Result_Tracker< RETURNTYPE, SUBSET > > | PResultTracker |
| | shared pointer to the result tracker enabled via enable_result_tracking()
|
|
typedef Search_Observer< RETURNTYPE, SUBSET > | OBSERVER |
| | the observer interface type this search reports through (see Search_Observer)
|
|
typedef std::shared_ptr< OBSERVER > | PObserver |
| | shared pointer to an OBSERVER, as set via set_observer()
|
|
| | Search_Ranking (PEvaluatorEngine engine=PEvaluatorEngine()) |
| virtual bool | evaluate_individuals (const DIMTYPE n, const PCriterion crit, std::ostream &os=std::cout)=0 |
| | ranks all n features individually by crit, filling bifs descending by criterion value (the order within a group of equal values is the concrete method's own convention); called by search() itself, and required before getFirstFeature()/getNextFeature() are used on their own – implemented by the concrete ranking method (e.g. Search_Ranking_BIF)
|
| virtual bool | search (const DIMTYPE target_d, RETURNTYPE &result, const PSubset sub, const PCriterion crit, std::ostream &os=std::cout) override |
| | ranks the features (evaluate_individuals()) and returns the target_d best-ranked ones, or - for target_d==0 - the best-valued prefix of the ranking; false if the ranking or one of the criterion evaluations failed. target_d must be smaller than the full feature count
|
|
bool | getFirstFeature (RETURNTYPE &value, DIMTYPE &feature) const |
| | iterator over bifs (the ranking built by evaluate_individuals()), highest-ranked feature first; returns false if bifs is empty
|
|
bool | getNextFeature (RETURNTYPE &value, DIMTYPE &feature) const |
| | continues the getFirstFeature() iteration; returns false once the ranking is exhausted. There is one cursor per object: it is protected against concurrent access in threaded builds, but two interleaved iterations of the same object still consume one another's positions
|
| virtual std::ostream & | print (std::ostream &os) const override |
| | writes a human-readable identification of the search and its configuration; base default writes nothing
|
|
void | enable_result_tracking (PResultTracker tracker) |
| | assigns a result tracker to the search process, i.e., enables logging of all evaluated subsets for future reuse (re-evaluation, etc.)
|
|
void | disable_result_tracking () |
| | detaches any result tracker (result_tracker_active() then returns false)
|
|
bool | result_tracker_active () const |
| | true if a result tracker was assigned via enable_result_tracking() and not since disabled
|
|
void | set_output_detail (OutputDetail detail) |
| | sets the amount of information that is logged to output stream throughout the course of search
|
|
OutputDetail | get_output_detail () const |
| | the currently configured output detail level
|
|
bool | output_normal () const |
| | true unless output detail is SILENT
|
|
bool | output_detailed () const |
| | true only at the DETAILED output level
|
|
void | set_observer (PObserver observer) |
| | redirects search progress reporting away from the default syncout text output to observer
|
template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION>
class FST::Search_Ranking< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >
Abstract base of the feature-ranking methods: scores features one by one, then turns the ranking into a feature subset.
A concrete ranking method supplies evaluate_individuals() only, which fills the protected bifs list with one (feature, criterion value) record per feature, ordered by descending value; the order of features of equal value is decided by that method. Everything else - the two search() modes, the feature-list bookkeeping and the iteration over the ranking - lives here.
search() has two modes:
- target_d>0: the target_d highest-ranked features form the result, which is evaluated once by the criterion; a result tracker receives that single record.
- target_d==0: every prefix of the ranking is evaluated - the best feature alone, the best two features, and so on - and the best-valued prefix is returned; equal values leave the shorter prefix in place. Here every evaluated prefix is reported to the result tracker.
target_d must be smaller than the full feature count. Note that a ranking of individually evaluated features ignores feature interactions by construction; its subsets are generally weaker than those found by the subset search methods, which is the price for the linear number of criterion evaluations.
template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION>
| virtual bool FST::Search_Ranking< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >::evaluate_individuals |
( |
const DIMTYPE | n, |
|
|
const PCriterion | crit, |
|
|
std::ostream & | os = std::cout ) |
|
pure virtual |