|
|
typedef Search_Sequential< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR > | parent |
| | base class alias
|
|
typedef parent::parent | grandparent |
| | the shared Search base (output detail, result tracker)
|
|
typedef std::shared_ptr< EVALUATOR > | PEvaluator |
| | shared pointer to the sequential-step evaluator
|
|
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 Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > | parent |
| | base class alias
|
|
typedef std::shared_ptr< EVALUATOR > | PEvaluator |
| | shared pointer to the sequential-step evaluator that implements Step()'s candidate generation and selection
|
|
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< 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_SFS (const PEvaluator evaluator) |
| | evaluator must be non-null; direction defaults to FORWARD (SFS); call set_search_direction(BACKWARD) for SBS
|
| virtual bool | search (const DIMTYPE target_d, RETURNTYPE &result, const PSubset sub, const PCriterion crit, std::ostream &os=std::cout) override |
| | Runs SFS (or SBS) and returns the resulting subset + its criterion value.
|
|
void | set_search_direction (const SearchDirection direction) |
| | FORWARD implies SFS, BACKWARD implies SBS (do not change concurrently to running search()).
|
|
SearchDirection | get_search_direction () const |
| | the currently configured direction (see set_search_direction())
|
|
bool | get_result (const DIMTYPE d, RETURNTYPE &result, PSubset &sub) |
| | retrieves the subset of cardinality d (1-based: d ranges over 1..n) recorded during the last search(), together with its criterion value; false if that search recorded nothing at this cardinality - which is the case for every size it did not visit, and for all sizes if it returned false. The contents are copied into sub, which must be non-null and dimensioned for the full feature set
|
| 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_Sequential (const PEvaluator evaluator) |
| | evaluator must be non-null
|
| bool | Step (const bool forward, RETURNTYPE &result, const PSubset sub, const PCriterion crit, std::ostream &os=std::cout) |
| | Performs one sequential step: adds (forward) or removes (!forward) the best g-tuple of features, g being the generalization level.
|
|
void | set_generalization_level (const DIMTYPE g) |
| | optional parameter to enlarge the number of considered candidates (g is the number of features added/removed in one Step)
|
|
DIMTYPE | get_generalization_level () const |
| | the currently configured generalization level (see set_generalization_level())
|
|
void | enable_initial_subset () |
| | makes search() start from the caller-supplied contents of its sub argument instead of the concrete method's default (empty set for FORWARD, full set for BACKWARD)
|
|
void | disable_initial_subset () |
| | reverts to the default: incoming sub contents are ignored by search()
|
|
bool | initial_subset_enabled () const |
| | true if enable_initial_subset() was called (and not since disabled by disable_initial_subset())
|
|
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 EVALUATOR>
class FST::Search_SFS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >
Implements Sequential_Forward_Selection and Sequential_Backward_Selection.
- Note
- By default any initial subset contents are ignored; SFS starts from empty set and SBS starts from full set. Call enable_initial_subset() to let the search start from the initial sub contents.
- Examples
- demo10.cpp.
template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION, class EVALUATOR>
| bool FST::Search_SFS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >::search |
( |
const DIMTYPE | target_d, |
|
|
RETURNTYPE & | result, |
|
|
const PSubset | sub, |
|
|
const PCriterion | crit, |
|
|
std::ostream & | os = std::cout ) |
|
overridevirtual |
Runs SFS (or SBS) and returns the resulting subset + its criterion value.
Starts from the empty set (FORWARD) or the full set (BACKWARD), unless enable_initial_subset() was called, in which case the incoming contents of sub are the starting point. Each step adds (removes) the best g-tuple of features, g being the generalization level, until target_d features are selected; with target_d==0 the search runs to the end of its range and returns the best-valued subset among all sizes visited.
- Returns
- false if the criterion failed on some subset, or if the requested combination of starting size, target_d and generalization level makes a solution unreachable (see the reachability test at the start of the body): for instance a forward search asked for fewer features than it starts with, or a target_d not reachable by whole g-sized steps.
Implements FST::Search_Sequential< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >.
- Examples
- demo10.cpp.