Feature Selection Toolbox FST4
UTIA · Czech Academy of Sciences
Loading...
Searching...
No Matches
FST::Criterion_Multinomial< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > Class Template Referenceabstract

Abstract class, defines interface for feature selection criterion implementations based on multinomial model. More...

#include <criterion_multinom.hpp>

Inheritance diagram for FST::Criterion_Multinomial< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >:
FST::Criterion_Filter< RETURNTYPE, SUBSET > FST::Criterion< RETURNTYPE, SUBSET > FST::Clonable FST::Clonable_Impl< Criterion_Multinomial_Bhattacharyya< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >, Criterion_Multinomial< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > > FST::Clonable_Impl< Criterion_Multinomial_MI< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >, Criterion_Multinomial< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > > FST::Criterion_Multinomial_Bhattacharyya< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > FST::Criterion_Multinomial_MI< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >

Public Types

typedef std::shared_ptr< DATAACCESSOR > PDataAccessor
 shared pointer to the data accessor the model is learned from
typedef std::shared_ptr< SUBSET > PSubset
 shared pointer to the feature subset being evaluated
Public Types inherited from FST::Criterion_Filter< RETURNTYPE, SUBSET >
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 initialize (PDataAccessor da)
 learns the multinomial model from da; subclasses must call this base before their own initialize() work.
virtual bool evaluate (RETURNTYPE &result, const PSubset sub) override=0
 Scores the given feature subset; higher is better (FST4 searches maximize).
virtual bool is_monotonic () const override
DIMTYPE get_n () const
 the full (raw, unnarrowed) feature count the model was learned for
DIMTYPE get_d () const
 the currently active (narrowed) feature count
Public Member Functions inherited from FST::Criterion< RETURNTYPE, SUBSET >
Criterion * clone () const override=0
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
virtual std::ostream & print (std::ostream &os) const
 writes a human-readable identification of the object; base default writes nothing

Protected Member Functions

 Criterion_Multinomial (const Criterion_Multinomial &cm)
 Copy-constructor; deep-copies _model.
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)

Protected Attributes

std::unique_ptr< Model_Multinomial< DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > > _model
 the learned per-class multinomial (term-probability) model

Detailed Description

template<class RETURNTYPE, typename DATATYPE, typename REALTYPE, typename IDXTYPE, typename DIMTYPE, class SUBSET, class DATAACCESSOR>
class FST::Criterion_Multinomial< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >

Abstract class, defines interface for feature selection criterion implementations based on multinomial model.

Intended for term-count data (text categorization and the like). The protocol is the same for both concrete criteria, Criterion_Multinomial_Bhattacharyya and Criterion_Multinomial_MI: initialize() learns ONE model over the FULL feature set from the training part of the data accessor, and each evaluate() then narrows that model to the subset being scored (or reads a cached per-feature statistic computed on the full model). The model is therefore learned once per data-split setting, not once per evaluated subset - call initialize() again whenever the accessor's split changes.

Member Function Documentation

◆ evaluate()

template<class RETURNTYPE, typename DATATYPE, typename REALTYPE, typename IDXTYPE, typename DIMTYPE, class SUBSET, class DATAACCESSOR>
virtual bool FST::Criterion_Multinomial< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >::evaluate ( RETURNTYPE & result,
const PSubset sub )
overridepure virtual

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 >.

Implemented in FST::Criterion_Multinomial_Bhattacharyya< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >, and FST::Criterion_Multinomial_MI< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >.

◆ initialize()

template<class RETURNTYPE, typename DATATYPE, typename REALTYPE, typename IDXTYPE, typename DIMTYPE, class SUBSET, class DATAACCESSOR>
bool FST::Criterion_Multinomial< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >::initialize ( PDataAccessor da)
virtual

learns the multinomial model from da; subclasses must call this base before their own initialize() work.

Returns
always true - model-learning problems are reported by throwing, not by the return value

Reimplemented in FST::Criterion_Multinomial_Bhattacharyya< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >, and FST::Criterion_Multinomial_MI< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >.

◆ is_monotonic()

template<class RETURNTYPE, typename DATATYPE, typename REALTYPE, typename IDXTYPE, typename DIMTYPE, class SUBSET, class DATAACCESSOR>
virtual bool FST::Criterion_Multinomial< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >::is_monotonic ( ) const
inlineoverridevirtual

both multinomial filters are monotonic w.r.t. subset cardinality, hence B&B-compatible: the multinomial Bhattacharyya distance cannot decrease when a feature is added, and the MI criterion is a SUM of nonnegative per-feature terms (removing a feature cannot increase it)

Reimplemented from FST::Criterion< RETURNTYPE, SUBSET >.


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.