Abstract class, defines interface for feature selection criterion implementations based on multinomial model. More...
#include <criterion_multinom.hpp>
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 | |
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.
|
overridepure virtual |
Scores the given feature subset; higher is better (FST4 searches maximize).
| result | set to the criterion value on success; left unspecified on failure |
| sub | the (fixed) subset to evaluate – only its selected features are read |
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 >.
|
virtual |
learns the multinomial model from da; subclasses must call this base before their own initialize() work.
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 >.
|
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 >.