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

Returns the (positive) subset size sub->get_d() - since FST4 searches maximize, this rates LARGER subsets higher. Wrap in Criterion_Negative to favor smaller subsets instead. More...

#include <criterion_subsetsize.hpp>

Inheritance diagram for FST::Criterion_Subset_Size< RETURNTYPE, SUBSET >:
FST::Clonable_Impl< Criterion_Subset_Size< RETURNTYPE, SUBSET >, Criterion< RETURNTYPE, SUBSET > > FST::Criterion< RETURNTYPE, SUBSET > FST::Clonable

Public Types

typedef Clonable_Impl< Criterion_Subset_Size, Criterion< RETURNTYPE, SUBSET > > parent_impl
 implements clone(); sharing/stateless_clone throw in Criterion
typedef std::shared_ptr< SUBSET > PSubset
 shared pointer to the feature subset being evaluated
Public Types inherited from FST::Criterion< RETURNTYPE, SUBSET >
typedef std::shared_ptr< SUBSET > PSubset
 shared pointer to the feature subset being evaluated

Public Member Functions

virtual bool evaluate (RETURNTYPE &result, const PSubset sub) override
 Scores the given feature subset; higher is better (FST4 searches maximize).
virtual std::ostream & print (std::ostream &os) const override
 writes a human-readable identification of the object; base default writes nothing
Public Member Functions inherited from FST::Clonable_Impl< Criterion_Subset_Size< RETURNTYPE, SUBSET >, Criterion< RETURNTYPE, SUBSET > >
Criterion< RETURNTYPE, SUBSET > * clone () const override
 dispatches to the DEEP_KIND mechanism (default CLONE_DEEP: Derived's copy-constructor)
Criterion< RETURNTYPE, SUBSET > * sharing_clone () const override
 dispatches to the SHARING_KIND mechanism (default CLONE_INHERIT: defers to Base, which throws by family convention)
Criterion< RETURNTYPE, SUBSET > * stateless_clone () const override
 dispatches to the STATELESS_KIND mechanism (default CLONE_INHERIT: defers to Base, which throws by family convention)
Public Member Functions inherited from FST::Criterion< RETURNTYPE, SUBSET >
virtual bool is_monotonic () const
Criterion * sharing_clone () const override
Criterion * stateless_clone () const override
Public Member Functions inherited from FST::Clonable
bool is_clone () const
bool is_sharing () const
 true if this instance is a sharing_clone() result (referencing, not owning, the source's structures)
bool is_sharing_clone () const
 true if this instance is BOTH a clone and sharing – i.e. specifically a sharing_clone() result, not a clone()/stateless_clone() one

Private Member Functions

 Criterion_Subset_Size (const Criterion_Subset_Size &css)
 Copy-constructor; the class carries no state of its own beyond what parent_impl copies.

Private Attributes

friend parent_impl

Additional Inherited Members

Protected Member Functions inherited from FST::Clonable
void set_cloned (const bool cloned=true)
 marks/unmarks this instance as a clone; call from clone()/stateless_clone() overrides (Clonable_Impl does this automatically)
void set_sharing (const bool sharing=true)
 marks/unmarks this instance as sharing (see is_sharing())
void set_sharing_cloned (const bool cloned=true, const bool sharing=true)
 sets both flags at once; call from sharing_clone() overrides (Clonable_Impl does this automatically)

Detailed Description

template<class RETURNTYPE, class SUBSET>
class FST::Criterion_Subset_Size< RETURNTYPE, SUBSET >

Returns the (positive) subset size sub->get_d() - since FST4 searches maximize, this rates LARGER subsets higher. Wrap in Criterion_Negative to favor smaller subsets instead.

This trivial criterion is intended as secondary criterion only to be used in conjunction with Result_Tracker_Regularizer, implementing feature selection regularization (improvement of feature selection generalization ability and result robustness) as described in paper "Somol, Grim, Pudil: The Problem of Fragile Feature Subset Preference in Feature Selection Methods and A Proposal of Algorithmic Workaround. In Proc. ICPR 2010. IEEE Computer Society, 2010". In the fst4 command-line tool this is what --regularize-by subsetsize selects, together with --regularize-margins and --tracker regularizer.

Note
Unlike the model-based criteria, which score the raw marker set they are handed and therefore read Subset::get_d_raw(), this one reads Subset::get_d(): the count of currently selected features EXCLUDING frozen ones, independent of the forward/backward search mode. That is the subset size the search itself manipulates, which is the quantity the regularization trade-off is about.
Examples
demo52t.cpp.

Member Function Documentation

◆ evaluate()

template<class RETURNTYPE, class SUBSET>
virtual bool FST::Criterion_Subset_Size< RETURNTYPE, SUBSET >::evaluate ( RETURNTYPE & result,
const PSubset sub )
inlineoverridevirtual

Scores the given feature subset; higher is better (FST4 searches maximize).

Parameters
resultset to the criterion value on success; left unspecified on failure
subthe (fixed) subset to evaluate – only its selected features are read
Returns
false if the subset cannot be evaluated at all (e.g. too small for the model, or singular statistics). This is NOT a per-candidate reject: callers treat it as fatal for the current search step or run – the sequential-step candidate evaluator marks its whole batch failed, streaming searches abort, and Branch & Bound throws. A criterion that can legitimately be undefined on some subsets must guard against reaching those subsets another way (e.g. a minimum-subset-size constraint), not by relying on evaluate() to skip them.

Implements FST::Criterion< RETURNTYPE, SUBSET >.

◆ print()

template<class RETURNTYPE, class SUBSET>
virtual std::ostream & FST::Criterion_Subset_Size< RETURNTYPE, SUBSET >::print ( std::ostream & os) const
inlineoverridevirtual

writes a human-readable identification of the object; base default writes nothing

Reimplemented from FST::Clonable.

Member Data Documentation

◆ parent_impl

template<class RETURNTYPE, class SUBSET>
friend FST::Criterion_Subset_Size< RETURNTYPE, SUBSET >::parent_impl
private

grants Clonable_Impl access to the copy-constructor


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.