Feature Selection Toolbox
FST4
UTIA · Czech Academy of Sciences
Home
Introduction
Usage
FST4 CLI
Demos
API Reference
Download
History
References
Legacy
FAQ
Contacts
Toggle main menu visibility
Loading...
Searching...
No Matches
_src_criteria
criterion.hpp
Go to the documentation of this file.
1
#ifndef FSTCRITERION_H
2
#define FSTCRITERION_H
3
/*
27
=========================================================================
28
Copyright and license:
29
* FST4 software (with the exception of any bundled or externally linked
30
third-party components) is Copyright (C) 2000-present Institute of
31
Information Theory and Automation of the Czech Academy of Sciences (UTIA).
32
* FST4 is free software: you can redistribute it and/or modify it under
33
the terms of the GNU Affero General Public License as published by the
34
Free Software Foundation, version 3. The full text of the license is in
35
the file LICENSE in the distribution root and at
36
https://www.gnu.org/licenses/agpl-3.0.html.
37
* FST4 is distributed in the hope that it will be useful, but WITHOUT ANY
38
WARRANTY; without even the implied warranty of MERCHANTABILITY or
39
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
40
License for more details.
41
* Closed-source use without the AGPL's copyleft obligations requires a
42
commercial license from UTIA; in case of interest write to
43
utia@utia.cas.cz. LICENSING.md in the distribution root explains both
44
options, the contributor license agreement that every contribution
45
requires, and the contacts (technical questions and pull requests:
46
somol@utia.cas.cz, with "FST" in the subject line).
47
========================================================================== */
48
49
#include <memory>
50
#include "
error.hpp
"
51
#include "
global.hpp
"
52
#include "
clonable.hpp
"
53
54
/*============== Template parameter type naming conventions ==============
55
--------- Numeric types: -------------------------------------------------
56
DATATYPE - data sample values - usually real numbers (but may be integers
57
in text processing etc.)
58
REALTYPE - must be real numbers - for representing intermediate results of
59
calculations like mean, covariance etc.
60
IDXTYPE - index values for enumeration of data samples - (nonnegative) integers,
61
extent depends on numbers of samples in data
62
DIMTYPE - index values for enumeration of features (dimensions), or classes (not
63
class sizes) - (nonnegative) integers, usually lower extent than IDXTYPE,
64
but be aware of expressions like _classes*_features*_features !
65
in linearized representations of feature matrices for all classes
66
BINTYPE - feature selection marker type - represents ca. <10 different feature
67
states (selected, deselected, sel./desel. temporarily 1st nested loop, 2nd...)
68
RETURNTYPE - criterion value: real value, but may be extended in future to support
69
multiple values
70
--------- Class types: ---------------------------------------------------
71
SUBSET - class of class type Subset
72
CLASSIFIER - class implementing interface defined in abstract class Classifier
73
EVALUATOR - class implementing interface defined in abstract class Sequential_Step
74
DISTANCE - class implementing interface defined in abstract class Distance
75
DATAACCESSOR - class implementing interface defined in abstract class Data_Accessor
76
INTERVALCONTAINER - class of class type Data_Intervaller
77
CONTAINER - STL container of class type Data_Interval
78
========================================================================== */
79
80
namespace
FST
{
81
83
template
<
class
RETURNTYPE,
class
SUBSET>
84
class
Criterion :
public
Clonable {
// abstract class
85
public
:
86
typedef
std::shared_ptr<SUBSET>
PSubset
;
87
Criterion() {}
88
virtual
~Criterion
() {}
89
100
virtual
bool
evaluate
(RETURNTYPE &result,
const
PSubset
sub) =0;
101
115
virtual
bool
is_monotonic
()
const
{
return
false
;}
116
117
Criterion*
clone
()
const override
=0;
118
Criterion*
sharing_clone
()
const override
{
throw
fst_error
(
"Criterion::sharing_clone() not supported, use Criterion::clone() instead."
);}
119
Criterion*
stateless_clone
()
const override
{
throw
fst_error
(
"Criterion::stateless_clone() not supported, use Criterion::clone() instead."
);}
120
};
121
125
template
<
class
RETURNTYPE,
class
SUBSET>
126
class
Criterion_Filter :
public
Criterion<RETURNTYPE,SUBSET> {
// abstract class
127
public
:
128
typedef
std::shared_ptr<SUBSET>
PSubset
;
129
Criterion_Filter() {}
130
virtual
~Criterion_Filter
() {}
131
};
132
133
134
}
// namespace
135
#endif
// FSTCRITERION_H ///:~
FST::Criterion_Filter
Abstract class, defines interface for classes implementing "independent" feature selection criteria.
Definition
criterion.hpp:126
FST::Criterion_Filter::PSubset
std::shared_ptr< SUBSET > PSubset
shared pointer to the feature subset being evaluated
Definition
criterion.hpp:128
FST::Criterion
Abstract class, defines interface for feature selection criterion classes.
Definition
criterion.hpp:84
FST::Criterion::evaluate
virtual bool evaluate(RETURNTYPE &result, const PSubset sub)=0
Scores the given feature subset; higher is better (FST4 searches maximize).
FST::Criterion::PSubset
std::shared_ptr< SUBSET > PSubset
shared pointer to the feature subset being evaluated
Definition
criterion.hpp:86
FST::Criterion::stateless_clone
Criterion * stateless_clone() const override
Definition
criterion.hpp:119
FST::Criterion::sharing_clone
Criterion * sharing_clone() const override
Definition
criterion.hpp:118
FST::Criterion::is_monotonic
virtual bool is_monotonic() const
Definition
criterion.hpp:115
FST::Criterion::clone
Criterion * clone() const override=0
FST::fst_error
FST4 specific error passing class.
Definition
error.hpp:61
clonable.hpp
Defines interface for classes that may need to get cloned.
error.hpp
FST4 specific error passing class.
global.hpp
Global definitions.
FST
The Feature Selection Toolbox 4 library: every library component – data access, criteria and classifi...
Definition
data_accessor.hpp:80
Generated by
1.17.0