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

Implements Sequential_Forward_Floating_Search and Sequential_Backward_Floating_Search. More...

#include <search_seq_sffs.hpp>

Inheritance diagram for FST::Search_SFFS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >:
FST::Search_Sequential< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR > FST::Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >

Classes

struct  OneSubset
 Structure to hold [subset,criterion value] temporary solutions in the course of search. More...

Public Types

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
Public Types inherited from FST::Search_Sequential< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >
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_SFFS (const PEvaluator evaluator)
 evaluator must be non-null; direction defaults to FORWARD (SFFS); call set_search_direction(BACKWARD) for SBFS
virtual bool search (const DIMTYPE target_d, RETURNTYPE &result, const PSubset sub, const PCriterion crit, std::ostream &os=std::cout) override
 returns found subset + criterion value
void set_search_direction (const SearchDirection direction)
 FORWARD selects SFFS, BACKWARD selects SBFS (do not change concurrently to a running search()).
SearchDirection get_search_direction () const
 the currently configured direction (see set_search_direction())
void set_delta (const DIMTYPE delta)
 optional parameter to restrict search extent: bounds the floating frontier to at most target_d+delta features forward and at least target_d-delta backward (0 = unrestricted, the classic full floating frontier); has no effect when target_d==0 (best-dimensionality search)
DIMTYPE get_delta () const
 the currently configured delta bound (see set_delta())
bool get_result (const DIMTYPE d, RETURNTYPE &result, PSubset &sub)
 retrieves temporary solution of cardinality d that had been updated in the course of the last search (if it exists)
virtual std::ostream & print (std::ostream &os) const override
 writes a human-readable identification of the search and its configuration; base default writes nothing
Public Member Functions inherited from FST::Search_Sequential< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >
 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())

Protected Attributes

SearchDirection _direction
DIMTYPE _delta
 frontier restriction around target_d (0 = unrestricted); see set_delta()
std::unique_ptr< OneSubset[]> bsubs
 per-cardinality best-known result found in the course of the last search() (index d-1); read by get_result()
DIMTYPE _n
 bsubs array size
std::unique_ptr< SUBSET > pivotsub
 the subset the next forward step continues from: the deepest backtracking result that improved its cardinality's record. NOTE the name means something else in Search_DOS, where "pivot" denotes the best-so-far subset - that one is called maxcritsub here
std::unique_ptr< SUBSET > maxcritsub
 stores the subset with maximum known crit value
Protected Attributes inherited from FST::Search_Sequential< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >
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_SFFS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >

Implements Sequential_Forward_Floating_Search and Sequential_Backward_Floating_Search.

Note
By default any initial subset contents are ignored; SFFS starts from empty set and SBFS starts from full set. Call enable_initial_subset() to let the search start from the initial sub contents.
This implementation follows the original SFFS definition closely. See Search_SFRS for a closely related, slower, but more thorough method.
Among subsets of EQUAL criterion value the search prefers the SMALLER one, both when updating the best-so-far used for the target_d==0 (optimize cardinality) answer and, implicitly, in that a per-cardinality record is only replaced by a strictly better value.
Examples
demo55.cpp.

Member Function Documentation

◆ print()

template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION, class EVALUATOR>
std::ostream & FST::Search_SFFS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >::print ( std::ostream & os) const
overridevirtual

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, class EVALUATOR>
bool FST::Search_SFFS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >::search ( const DIMTYPE target_d,
RETURNTYPE & result,
const PSubset sub,
const PCriterion crit,
std::ostream & os = std::cout )
overridevirtual

returns found subset + criterion value

Implements FST::Search_Sequential< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >.

Examples
demo55.cpp.

Member Data Documentation

◆ _direction

template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION, class EVALUATOR>
SearchDirection FST::Search_SFFS< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, EVALUATOR >::_direction
protected

accepted values FORWARD for SFFS or BACKWARD for SBFS


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.