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_search
branch_and_bound_predictor.hpp
Go to the documentation of this file.
1
#ifndef FSTSEARCHBRANCHANDBOUNDPREDICTOR_H
2
#define FSTSEARCHBRANCHANDBOUNDPREDICTOR_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
53
/*============== Template parameter type naming conventions ==============
54
--------- Numeric types: -------------------------------------------------
55
DATATYPE - data sample values - usually real numbers (but may be integers
56
in text processing etc.)
57
REALTYPE - must be real numbers - for representing intermediate results of
58
calculations like mean, covariance etc.
59
IDXTYPE - index values for enumeration of data samples - (nonnegative) integers,
60
extent depends on numbers of samples in data
61
DIMTYPE - index values for enumeration of features (dimensions), or classes (not
62
class sizes) - (nonnegative) integers, usually lower extent than IDXTYPE,
63
but be aware of expressions like _classes*_features*_features !
64
in linearized representations of feature matrices for all classes
65
BINTYPE - feature selection marker type - represents ca. <10 different feature
66
states (selected, deselected, sel./desel. temporarily 1st nested loop, 2nd...)
67
RETURNTYPE - criterion value: real value, but may be extended in future to support
68
multiple values
69
--------- Class types: ---------------------------------------------------
70
SUBSET - class of class type Subset
71
CLASSIFIER - class implementing interface defined in abstract class Classifier
72
EVALUATOR - class implementing interface defined in abstract class Sequential_Step
73
DISTANCE - class implementing interface defined in abstract class Distance
74
DATAACCESSOR - class implementing interface defined in abstract class Data_Accessor
75
INTERVALCONTAINER - class of class type Data_Intervaller
76
CONTAINER - STL container of class type Data_Interval
77
========================================================================== */
78
79
namespace
FST
{
80
81
template
<
class
RETURNTYPE,
typename
DIMTYPE>
82
class
Branch_And_Bound_Predictor
;
83
84
template
<
class
RETURNTYPE,
typename
DIMTYPE>
85
std::ostream&
operator<<
(std::ostream& os,
const
Branch_And_Bound_Predictor<RETURNTYPE,DIMTYPE>
& babp);
86
100
template
<
class
RETURNTYPE,
typename
DIMTYPE>
101
class
Branch_And_Bound_Predictor {
103
friend
std::ostream& operator<< <>(std::ostream& os,
const
Branch_And_Bound_Predictor<RETURNTYPE,DIMTYPE>& babp);
104
public
:
105
Branch_And_Bound_Predictor() {
notify
(
"Branch_And_Bound_Predictor constructor."
);}
106
virtual
~Branch_And_Bound_Predictor() {
notify
(
"Branch_And_Bound_Predictor destructor."
);}
107
111
virtual
void
initialize
(
const
DIMTYPE features)=0;
116
virtual
bool
learn
(
const
DIMTYPE feature,
const
RETURNTYPE value)=0;
121
virtual
bool
predict
(
const
DIMTYPE feature, RETURNTYPE &value)
const
=0;
122
123
virtual
std::ostream&
print
(std::ostream& os)
const
{
return
os;}
124
};
125
127
template
<
class
RETURNTYPE,
typename
DIMTYPE>
128
std::ostream&
operator<<
(std::ostream& os,
const
Branch_And_Bound_Predictor<RETURNTYPE,DIMTYPE>& babp) {
129
return
babp.
print
(os);
130
}
131
132
}
// namespace
133
#endif
// FSTSEARCHBRANCHANDBOUNDPREDICTOR_H ///:~
FST::Branch_And_Bound_Predictor
Defines Interface for Implementations of Prediction Mechanism in Fast Branch and Bound & Branch and B...
Definition
branch_and_bound_predictor.hpp:101
FST::Branch_And_Bound_Predictor::learn
virtual bool learn(const DIMTYPE feature, const RETURNTYPE value)=0
Records an observed criterion value for feature, updating that feature's state only (see the class's ...
FST::Branch_And_Bound_Predictor::initialize
virtual void initialize(const DIMTYPE features)=0
(Re)initializes the predictor's per-feature state for features features; must be called before learn(...
FST::Branch_And_Bound_Predictor::print
virtual std::ostream & print(std::ostream &os) const
writes a human-readable identification of the predictor's learned state; base default writes nothing
Definition
branch_and_bound_predictor.hpp:123
FST::Branch_And_Bound_Predictor::predict
virtual bool predict(const DIMTYPE feature, RETURNTYPE &value) const =0
Predicts feature's criterion value from its previously learn()ed observations, without evaluating the...
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
FST::operator<<
std::ostream & operator<<(std::ostream &os, const Data_Intervaller< CONTAINER, IDXTYPE > &ia)
Streams every contained interval as "si:<startidx>, c:<count>" lines to os.
Definition
data_intervaller.hpp:152
Generated by
1.17.0