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

Implements Best Individual Features, i.e., individual feature ranking. More...

#include <search_ranking_bif.hpp>

Inheritance diagram for FST::Search_Ranking_BIF< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >:
FST::Search_Ranking< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > FST::Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > FST::Search_Ranking_BIF_Threaded< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >

Public Types

typedef Search_Ranking< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > parent
 base class: the individual-ranking search skeleton (final best-dimensionality scan, feature-list bookkeeping)
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 parent::PEvaluatorEngine PEvaluatorEngine
 the candidate-evaluation engine type, inherited from parent
Public Types inherited from FST::Search_Ranking< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >
typedef Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > parent
 the abstract Search interface this class implements
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 Candidate_Evaluator< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > EVALUATORENGINE
 the injected candidate-evaluation engine interface driving individual-feature evaluation
typedef std::shared_ptr< EVALUATORENGINE > PEvaluatorEngine

Public Member Functions

 Search_Ranking_BIF (PEvaluatorEngine engine=PEvaluatorEngine())
 Constructs the search with the given candidate-evaluation engine; a default-constructed engine falls back to sequential in-line evaluation.
virtual bool evaluate_individuals (const DIMTYPE n, const PCriterion crit, std::ostream &os=std::cout) override
 Scores every single feature individually under crit and ranks them into parent::bifs (descending), the BIF core step consumed by Search_Ranking::search().
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_Ranking< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >
 Search_Ranking (PEvaluatorEngine engine=PEvaluatorEngine())
virtual bool search (const DIMTYPE target_d, RETURNTYPE &result, const PSubset sub, const PCriterion crit, std::ostream &os=std::cout) override
 ranks the features (evaluate_individuals()) and returns the target_d best-ranked ones, or - for target_d==0 - the best-valued prefix of the ranking; false if the ranking or one of the criterion evaluations failed. target_d must be smaller than the full feature count
bool getFirstFeature (RETURNTYPE &value, DIMTYPE &feature) const
 iterator over bifs (the ranking built by evaluate_individuals()), highest-ranked feature first; returns false if bifs is empty
bool getNextFeature (RETURNTYPE &value, DIMTYPE &feature) const
 continues the getFirstFeature() iteration; returns false once the ranking is exhausted. There is one cursor per object: it is protected against concurrent access in threaded builds, but two interleaved iterations of the same object still consume one another's positions

Additional Inherited Members

Protected Types inherited from FST::Search_Ranking< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >
typedef std::list< OneFeature > FEATURELIST
 the individual-feature ranking built by evaluate_individuals(), sorted descending by critval
Protected Attributes inherited from FST::Search_Ranking< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >
PEvaluatorEngine _engine
FEATURELIST bifs
 the individual-feature ranking; empty until evaluate_individuals() is called

Detailed Description

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

Implements Best Individual Features, i.e., individual feature ranking.

Each feature is evaluated alone, as a subset of size one, and the features are ordered by descending criterion value; the inherited Search_Ranking::search() then turns that ranking into the resulting subset.

Note
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. The best-dimensionality scan in the inherited Search_Ranking::search() runs through the same engine. The ranking does not depend on the engine - the same features are ranked in the same order at any thread count.

Constructor & Destructor Documentation

◆ Search_Ranking_BIF()

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

Constructs the search with the given candidate-evaluation engine; a default-constructed engine falls back to sequential in-line evaluation.

Parameters
enginethe evaluation strategy to use; pass a Candidate_Evaluator_Threaded to evaluate the individual features in a thread pool

Member Function Documentation

◆ evaluate_individuals()

template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION>
bool FST::Search_Ranking_BIF< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >::evaluate_individuals ( const DIMTYPE n,
const PCriterion crit,
std::ostream & os = std::cout )
overridevirtual

Scores every single feature individually under crit and ranks them into parent::bifs (descending), the BIF core step consumed by Search_Ranking::search().

Parameters
nnumber of features to evaluate (features 0..n-1)
critthe criterion each singleton feature subset is scored with
osstream progress messages are reported to at NORMAL/DETAILED output detail
Returns
false if any individual evaluation fails (the candidate evaluator's add_candidate()/collect() returned false)
Note
Features of equal criterion value end up in descending feature-index order, because each newly ranked feature is inserted ahead of the equally valued ones already in the list. The order matters: it decides which of the tied features enter a subset of a given size.

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

◆ print()

template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION>
virtual std::ostream & FST::Search_Ranking_BIF< 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_Ranking< 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.