Feature Selection Toolbox FST4
UTIA · Czech Academy of Sciences
Loading...
Searching...
No Matches
FST::Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > Class Template Referenceabstract

abstract class, defines interface for search method implementations More...

#include <search.hpp>

Inheritance diagram for FST::Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >:
FST::Search_Branch_And_Bound< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > FST::Search_Exhaustive< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > FST::Search_Monte_Carlo< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > FST::Search_Ranking< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > FST::Search_Sequential< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR > FST::Search_Branch_And_Bound_Basic< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > FST::Search_Branch_And_Bound_Fast< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, PREDICTOR > FST::Search_Branch_And_Bound_Improved< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > FST::Search_Branch_And_Bound_Partial_Prediction< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, PREDICTOR > FST::Search_Exhaustive_Threaded< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > FST::Search_Monte_Carlo_Threaded< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > FST::Search_Ranking_BIF< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > FST::Search_DOS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR > FST::Search_OS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR > FST::Search_SFFS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR > FST::Search_SFRS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR > FST::Search_SFS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >

Public Types

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()

Public Member Functions

virtual bool search (const DIMTYPE target_d, RETURNTYPE &result, const PSubset sub, const PCriterion crit, std::ostream &os)=0
 Runs the search; the central entry point of every search method.
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
virtual std::ostream & print (std::ostream &os) const
 writes a human-readable identification of the search and its configuration; base default writes nothing

Protected Member Functions

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

Protected Attributes

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())

Friends

std::ostream & operator<< (std::ostream &os, const Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > &sr)
 Streams a search's print() to os.

Detailed Description

template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION>
class FST::Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >

abstract class, defines interface for search method implementations

Member Function Documentation

◆ print()

◆ search()

template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION>
virtual bool FST::Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >::search ( const DIMTYPE target_d,
RETURNTYPE & result,
const PSubset sub,
const PCriterion crit,
std::ostream & os )
pure virtual

Runs the search; the central entry point of every search method.

Parameters
target_drequested subset size; 0 asks the method to optimize the subset size as well (not every method supports this - see the concrete class)
resultreceives the criterion value of the returned subset; its value is meaningful only if the call returns true
subnon-null subset object dimensioned for the full feature set (its get_n() defines n); on success it holds the selected features. Its incoming contents are ignored unless the concrete method has been told to start from them (Search_Sequential::enable_initial_subset())
critthe criterion to maximize; must have been initialize()d before this call
osstream the progress messages are written to when no observer is attached
Returns
false if no valid subset was produced - the criterion failed to evaluate, the requested target_d is not reachable, or no candidate could be generated; result and sub are then left meaningless

While the search runs, an attached observer (set_observer()) receives on_solution() once per newly reached best (sub-)solution - typically many times per search() call - and on_progress() for all other messages.

Implemented in FST::Search_Branch_And_Bound< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >, FST::Search_DOS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >, FST::Search_Exhaustive< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >, FST::Search_Monte_Carlo< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >, FST::Search_OS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >, FST::Search_Ranking< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >, FST::Search_Sequential< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >, FST::Search_SFFS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >, FST::Search_SFRS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >, and FST::Search_SFS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >.


The documentation for this class was generated from the following file:
Copyright © 2000–present ÚTIA, Institute of Information Theory and Automation of the Czech Academy of Sciences · Contacts · This site sets no cookies and uses no analytics.