Feature Selection Toolbox FST4
UTIA · Czech Academy of Sciences
Loading...
Searching...
No Matches
model.hpp
Go to the documentation of this file.
1#ifndef FSTMODEL_H
2#define FSTMODEL_H
3 /*
27=========================================================================
28Copyright 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 <iostream>
51#include "error.hpp"
52#include "global.hpp"
53
54/*============== Template parameter type naming conventions ==============
55--------- Numeric types: -------------------------------------------------
56DATATYPE - data sample values - usually real numbers (but may be integers
57 in text processing etc.)
58REALTYPE - must be real numbers - for representing intermediate results of
59 calculations like mean, covariance etc.
60IDXTYPE - index values for enumeration of data samples - (nonnegative) integers,
61 extent depends on numbers of samples in data
62DIMTYPE - 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
66BINTYPE - feature selection marker type - represents ca. <10 different feature
67 states (selected, deselected, sel./desel. temporarily 1st nested loop, 2nd...)
68RETURNTYPE - criterion value: real value, but may be extended in future to support
69 multiple values
70--------- Class types: ---------------------------------------------------
71SUBSET - class of class type Subset
72CLASSIFIER - class implementing interface defined in abstract class Classifier
73EVALUATOR - class implementing interface defined in abstract class Sequential_Step
74DISTANCE - class implementing interface defined in abstract class Distance
75DATAACCESSOR - class implementing interface defined in abstract class Data_Accessor
76INTERVALCONTAINER - class of class type Data_Intervaller
77CONTAINER - STL container of class type Data_Interval
78========================================================================== */
79
80namespace FST {
81
89template<class SUBSET, class DATAACCESSOR>
90class Model {
91public:
92 typedef std::shared_ptr<DATAACCESSOR> PDataAccessor;
93 typedef std::shared_ptr<SUBSET> PSubset;
94 Model() {notify("Model constructor");}
95 virtual ~Model() {notify("Model destructor");}
101 virtual void learn(PDataAccessor da) =0;
105 virtual void narrow_to(const PSubset sub) =0; // access to data will be mapped to sub-matrix
107 virtual void denarrow() =0; // access is reset to the full matrix
108};
109
110} // namespace
111#endif // FSTMODEL_H ///:~
abstract class, defines interface for data model implementations
Definition model.hpp:90
virtual void denarrow()=0
Undoes narrow_to(): model access reverts to the full dimensionality it was learned at.
virtual void learn(PDataAccessor da)=0
Fits the model's parameters from da's training data, over all its features. Concrete models may addit...
std::shared_ptr< SUBSET > PSubset
shared pointer to a feature subset, as consumed by narrow_to()
Definition model.hpp:93
virtual void narrow_to(const PSubset sub)=0
std::shared_ptr< DATAACCESSOR > PDataAccessor
shared pointer to the data accessor supplying training data
Definition model.hpp:92
FST4 specific error passing class.
Global definitions.
The Feature Selection Toolbox 4 library: every library component – data access, criteria and classifi...
Definition data_accessor.hpp:80
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
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.