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

Returns the negative of another Criterion's result. More...

#include <criterion_negative.hpp>

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

Public Types

typedef Clonable_Impl< Criterion_Negative, Criterion< RETURNTYPE, SUBSET > > parent_impl
 implements clone(); sharing/stateless_clone throw in Criterion
typedef std::shared_ptr< CRITERION > PCriterion
 shared pointer to the wrapped criterion whose result is negated
typedef std::shared_ptr< SUBSET > PSubset
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

 Criterion_Negative (const PCriterion crit)
 Constructs the adapter around crit, the criterion whose evaluate() result is negated.
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_Negative< CRITERION, 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_Negative (const Criterion_Negative &cn)
 Copy-constructor; clones _crit.

Private Attributes

friend parent_impl
PCriterion _crit
 the wrapped criterion whose evaluate() result is negated

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 CRITERION, class RETURNTYPE, class SUBSET>
class FST::Criterion_Negative< CRITERION, RETURNTYPE, SUBSET >

Returns the negative of another Criterion's result.

This trivial criterion can be used to turn maximization to minimization. Useful, e.g., in subset size minimizing scenarios (in conjunction with Criterion_Subset_Size) or in feature acquisition weight minimization scenarios (in conjunction with Criterion_Sum_Of_Weights).

Note
is_monotonic() is left at its false default and must stay there: negating a criterion destroys cardinality monotonicity by construction. If the wrapped criterion cannot decrease when a feature is added, the negated one cannot increase - which is the opposite property, and not the one Branch & Bound prunes on. A negated criterion is therefore never a valid Branch & Bound criterion, however monotonic its operand.
Examples
demo52t.cpp.

Member Typedef Documentation

◆ PSubset

template<class CRITERION, class RETURNTYPE, class SUBSET>
typedef std::shared_ptr<SUBSET> FST::Criterion_Negative< CRITERION, RETURNTYPE, SUBSET >::PSubset

shared pointer to the feature subset being evaluated

Member Function Documentation

◆ evaluate()

template<class CRITERION, class RETURNTYPE, class SUBSET>
virtual bool FST::Criterion_Negative< CRITERION, 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 CRITERION, class RETURNTYPE, class SUBSET>
virtual std::ostream & FST::Criterion_Negative< CRITERION, 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 CRITERION, class RETURNTYPE, class SUBSET>
friend FST::Criterion_Negative< CRITERION, 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.