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_subsetsize.hpp
Go to the documentation of this file.
1
#ifndef FSTCRITERIONSUBSETSIZE_H
2
#define FSTCRITERIONSUBSETSIZE_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 <cassert>
51
#include <iostream>
52
#include "
error.hpp
"
53
#include "
global.hpp
"
54
#include "
criterion.hpp
"
55
56
/*============== Template parameter type naming conventions ==============
57
--------- Numeric types: -------------------------------------------------
58
DATATYPE - data sample values - usually real numbers (but may be integers
59
in text processing etc.)
60
REALTYPE - must be real numbers - for representing intermediate results of
61
calculations like mean, covariance etc.
62
IDXTYPE - index values for enumeration of data samples - (nonnegative) integers,
63
extent depends on numbers of samples in data
64
DIMTYPE - index values for enumeration of features (dimensions), or classes (not
65
class sizes) - (nonnegative) integers, usually lower extent than IDXTYPE,
66
but be aware of expressions like _classes*_features*_features !
67
in linearized representations of feature matrices for all classes
68
BINTYPE - feature selection marker type - represents ca. <10 different feature
69
states (selected, deselected, sel./desel. temporarily 1st nested loop, 2nd...)
70
RETURNTYPE - criterion value: real value, but may be extended in future to support
71
multiple values
72
--------- Class types: ---------------------------------------------------
73
SUBSET - class of class type Subset
74
CLASSIFIER - class implementing interface defined in abstract class Classifier
75
EVALUATOR - class implementing interface defined in abstract class Sequential_Step
76
DISTANCE - class implementing interface defined in abstract class Distance
77
DATAACCESSOR - class implementing interface defined in abstract class Data_Accessor
78
INTERVALCONTAINER - class of class type Data_Intervaller
79
CONTAINER - STL container of class type Data_Interval
80
========================================================================== */
81
82
namespace
FST
{
83
104
template
<
class
RETURNTYPE,
class
SUBSET>
105
class
Criterion_Subset_Size :
public
Clonable_Impl
<Criterion_Subset_Size<RETURNTYPE,SUBSET>,Criterion<RETURNTYPE,SUBSET> > {
// adapter class
106
public
:
107
typedef
Clonable_Impl<Criterion_Subset_Size,Criterion<RETURNTYPE,SUBSET>
>
parent_impl
;
108
typedef
std::shared_ptr<SUBSET>
PSubset
;
109
Criterion_Subset_Size() {
notify
(
"Criterion_Subset_Size constructor."
);}
110
virtual
~Criterion_Subset_Size
() {
notify
(
"Criterion_Subset_Size destructor."
);}
111
112
virtual
bool
evaluate
(RETURNTYPE &result,
const
PSubset
sub)
override
{assert(sub); result=RETURNTYPE(sub->get_d());
notify
(
"CSS result="
,result,
", getd "
,sub->get_d(),
"."
);
return
true
;}
113
114
115
116
virtual
std::ostream&
print
(std::ostream& os)
const override
{os <<
"Criterion_Subset_Size()"
;
return
os;}
117
private
:
118
friend
parent_impl
;
120
Criterion_Subset_Size(
const
Criterion_Subset_Size& css);
121
protected
:
122
};
123
124
template
<
class
RETURNTYPE,
class
SUBSET>
125
Criterion_Subset_Size<RETURNTYPE,SUBSET>::Criterion_Subset_Size(
const
Criterion_Subset_Size& css)
126
{
127
notify
(
"Criterion_Subset_Size copy-constructor."
);
128
}
129
130
131
132
}
// namespace
133
#endif
// FSTCRITERIONSUBSETSIZE_H ///:~
FST::Clonable_Impl
CRTP mixin implementing the Clonable protocol for a concrete class.
Definition
clonable.hpp:184
FST::Criterion_Subset_Size
Returns the (positive) subset size sub->get_d() - since FST4 searches maximize, this rates LARGER sub...
Definition
criterion_subsetsize.hpp:105
FST::Criterion_Subset_Size::PSubset
std::shared_ptr< SUBSET > PSubset
shared pointer to the feature subset being evaluated
Definition
criterion_subsetsize.hpp:108
FST::Criterion_Subset_Size::evaluate
virtual bool evaluate(RETURNTYPE &result, const PSubset sub) override
Scores the given feature subset; higher is better (FST4 searches maximize).
Definition
criterion_subsetsize.hpp:112
FST::Criterion_Subset_Size::print
virtual std::ostream & print(std::ostream &os) const override
writes a human-readable identification of the object; base default writes nothing
Definition
criterion_subsetsize.hpp:116
FST::Criterion_Subset_Size::parent_impl
Clonable_Impl< Criterion_Subset_Size, Criterion< RETURNTYPE, SUBSET > > parent_impl
implements clone(); sharing/stateless_clone throw in Criterion
Definition
criterion_subsetsize.hpp:107
criterion.hpp
Defines interface for feature selection criterion classes.
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
FST::notify
void notify(const std::string msg)
Prints msg followed by a newline via syncout::print(); a no-op unless the preprocessor macro DEBUG is...
Definition
global.hpp:112
Generated by
1.17.0