|
|
typedef Search_Ranking< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > | parent |
| | base class: the individual-ranking search skeleton (final best-dimensionality scan, feature-list bookkeeping)
|
|
typedef std::shared_ptr< CRITERION > | PCriterion |
| | shared pointer to the criterion being optimized
|
|
typedef std::shared_ptr< SUBSET > | PSubset |
| | shared pointer to a feature subset
|
|
typedef parent::PEvaluatorEngine | PEvaluatorEngine |
| | the candidate-evaluation engine type, inherited from parent
|
|
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_BIF (PEvaluatorEngine engine=PEvaluatorEngine()) |
| | Constructs the search with the given candidate-evaluation engine; a default-constructed engine falls back to sequential in-line evaluation.
|
| virtual bool | evaluate_individuals (const DIMTYPE n, const PCriterion crit, std::ostream &os=std::cout) override |
| | Scores every single feature individually under crit and ranks them into parent::bifs (descending), the BIF core step consumed by Search_Ranking::search().
|
| virtual std::ostream & | print (std::ostream &os) const override |
| | writes a human-readable identification of the search and its configuration; base default writes nothing
|
| | Search_Ranking (PEvaluatorEngine engine=PEvaluatorEngine()) |
| 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
|
|
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
|
|
|
typedef std::list< OneFeature > | FEATURELIST |
| | the individual-feature ranking built by evaluate_individuals(), sorted descending by critval
|
|
void | report (std::ostream &os, const msgbuf &m) const |
| | delivers one pre-formatted progress message: to the observer if attached, otherwise as syncout text to os
|
|
void | report_solution (std::ostream &os, const RETURNTYPE value, const SUBSET &sub, const msgbuf &m) const |
| | like report(), for sites announcing a new (sub-)solution; fires on_solution instead
|
| PEvaluatorEngine | _engine |
|
FEATURELIST | bifs |
| | the individual-feature ranking; empty until evaluate_individuals() is called
|
|
PResultTracker | _tracker |
| | the assigned result tracker, or null (see enable_result_tracking()/result_tracker_active())
|
|
OutputDetail | _detail |
| | the output detail level set via set_output_detail(); read by output_normal()/output_detailed()
|
|
PObserver | _observer |
| | the attached progress observer, or null (see set_observer(), report(), report_solution())
|
template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION>
class FST::Search_Ranking_BIF< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >
Implements Best Individual Features, i.e., individual feature ranking.
Each feature is evaluated alone, as a subset of size one, and the features are ordered by descending criterion value; the inherited Search_Ranking::search() then turns that ranking into the resulting subset.
- Note
- This single class serves both the sequential and the threaded execution model: the evaluation strategy (a Candidate_Evaluator implementation) is injected through the constructor and defaults to sequential in-line evaluation. The best-dimensionality scan in the inherited Search_Ranking::search() runs through the same engine. The ranking does not depend on the engine - the same features are ranked in the same order at any thread count.
template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION>
| bool FST::Search_Ranking_BIF< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >::evaluate_individuals |
( |
const DIMTYPE | n, |
|
|
const PCriterion | crit, |
|
|
std::ostream & | os = std::cout ) |
|
overridevirtual |
Scores every single feature individually under crit and ranks them into parent::bifs (descending), the BIF core step consumed by Search_Ranking::search().
- Parameters
-
| n | number of features to evaluate (features 0..n-1) |
| crit | the criterion each singleton feature subset is scored with |
| os | stream progress messages are reported to at NORMAL/DETAILED output detail |
- Returns
- false if any individual evaluation fails (the candidate evaluator's add_candidate()/collect() returned false)
- Note
- Features of equal criterion value end up in descending feature-index order, because each newly ranked feature is inserted ahead of the equally valued ones already in the list. The order matters: it decides which of the tied features enter a subset of a given size.
Implements FST::Search_Ranking< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >.