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

Abstract class, defines interface for sequential search method implementations, provides common implementation of the "sequential step" operation. More...

#include <search_seq.hpp>

Inheritance diagram for FST::Search_Sequential< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >:
FST::Search< 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 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

Public Member Functions

 Search_Sequential (const PEvaluator evaluator)
 evaluator must be non-null
virtual bool search (const DIMTYPE target_d, RETURNTYPE &result, const PSubset sub, const PCriterion crit, std::ostream &os) override=0
 returns the found subset of target_d features + its criterion value; target_d==0 asks the method to pick the best subset size itself (it then keeps the best-valued subset over all sizes it visits)
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())

Protected Attributes

PEvaluator _evaluator
 the sequential-step evaluator injected at construction; drives Step()'s candidate generation and best/worst choice
DIMTYPE _generalization_level
 number of features added/removed together in one Step() call (see set_generalization_level())
bool _initial_subset_enabled
 by default all concrete search methods ignore the contents of supplied 'PSubset set' and initialize sub according to their definition; if enabled, then (if possible) the search() starts from supplied 'PSubset sub' contents

Additional Inherited Members

Detailed Description

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

Abstract class, defines interface for sequential search method implementations, provides common implementation of the "sequential step" operation.

Note
To prevent misunderstanding: _generalization_level here does not relate to classification performance on unknown data, but to "generalization" of the course of search, i.e., the number of features added/removed while generating candidate subsets in one sequential step (higher generalization=more candidates). See book Devijver, Kittler, 1982 for discussion.

Member Function Documentation

◆ search()

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

◆ Step()

template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION, class EVALUATOR>
bool FST::Search_Sequential< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >::Step ( const bool forward,
RETURNTYPE & result,
const PSubset sub,
const PCriterion crit,
std::ostream & os = std::cout )
inline

Performs one sequential step: adds (forward) or removes (!forward) the best g-tuple of features, g being the generalization level.

The work is done by the injected evaluator, which replaces sub's contents by the candidate it chose and stores its criterion value in result. The subset's forward/backward mode is switched for the duration of the call and restored afterwards, so a backward step inside a forward search costs nothing but the step itself.

Returns
the evaluator's success flag: false if it could not generate a candidate (nothing left to add or remove) or a criterion evaluation failed. sub is the traversal state of the candidate enumeration and may have been modified even then - it is the caller's business to abandon the search.

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.