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

Implements exhaustive (optimal) search yielding optimal feature subset with respect to chosen criterion. More...

#include <search_exhaustive.hpp>

Inheritance diagram for FST::Search_Exhaustive< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >:
FST::Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > FST::Search_Exhaustive_Threaded< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >

Public Types

typedef Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > parent
 base class: the generic search interface
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 Candidate_Evaluator< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > EVALUATORENGINE
 the candidate-evaluation engine type (sequential or threaded)
typedef std::shared_ptr< EVALUATORENGINE > PEvaluatorEngine
 shared pointer to the evaluation engine

Public Member Functions

 Search_Exhaustive (PEvaluatorEngine engine=PEvaluatorEngine())
 Constructs the search with the given candidate-evaluation engine; a default-constructed engine falls back to Candidate_Evaluator_Sequential (in-line, unthreaded evaluation).
virtual bool search (const DIMTYPE target_d, RETURNTYPE &result, const PSubset sub, const PCriterion crit, std::ostream &os=std::cout) override
 evaluates every subset of the requested size (every subset of any size from 1 to n if target_d==0) and returns the best one + its criterion value; false if no candidate could be generated (n==0, or the subset object refused to enumerate) or a criterion evaluation failed
virtual std::ostream & print (std::ostream &os) const override
 writes a human-readable identification of the search and its configuration; base default writes nothing

Protected Attributes

PEvaluatorEngine _engine
 the injected candidate-evaluation engine (defaults to sequential)

Additional Inherited Members

Detailed Description

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

Implements exhaustive (optimal) search yielding optimal feature subset with respect to chosen criterion.

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; construct with a Candidate_Evaluator_Threaded to evaluate candidates in a thread pool. Results are the same either way - for a fixed seed the search yields the same subset at any thread count. Candidates are streamed to the evaluation engine - they are never materialized as a whole (their count grows combinatorially with n).

Note
Due to possibly high number of subsets to be tested expect excessive computational time. In case of result tracking the excessive number of possible combinations may consume unacceptable amount of memory - to prevent this it is highly recommended to set up result tracker storage limit.

Constructor & Destructor Documentation

◆ Search_Exhaustive()

template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION>
FST::Search_Exhaustive< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >::Search_Exhaustive ( PEvaluatorEngine engine = PEvaluatorEngine())
inlineexplicit

Constructs the search with the given candidate-evaluation engine; a default-constructed engine falls back to Candidate_Evaluator_Sequential (in-line, unthreaded evaluation).

Parameters
enginethe evaluation strategy to use; pass a Candidate_Evaluator_Threaded to evaluate candidates in a thread pool

Member Function Documentation

◆ print()

template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION>
virtual std::ostream & FST::Search_Exhaustive< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >::print ( std::ostream & os) const
inlineoverridevirtual

writes a human-readable identification of the search and its configuration; base default writes nothing

Reimplemented from FST::Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >.

◆ search()

template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION>
bool FST::Search_Exhaustive< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >::search ( const DIMTYPE target_d,
RETURNTYPE & result,
const PSubset sub,
const PCriterion crit,
std::ostream & os = std::cout )
overridevirtual

evaluates every subset of the requested size (every subset of any size from 1 to n if target_d==0) and returns the best one + its criterion value; false if no candidate could be generated (n==0, or the subset object refused to enumerate) or a criterion evaluation failed

Implements FST::Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >.


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.