Debian Codegraph @

src/algorithms/CostFactory.h

raw symbols SCIP
1 /**********************************************************************
2 CostFactory.h: select features, typical use: feature selection for classification
3 Author(s): [email protected]
4 Copyright (C) 2016-2020 European Union (Joint Research Centre)
5
6 This file is part of jiplib.
7
8 jiplib is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 jiplib is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with jiplib. If not, see <https://www.gnu.org/licenses/>.
20 ***********************************************************************/
21 #ifndef _COSTFACTORY_H_
22 #define _COSTFACTORY_H_
23
24 /* #include <math.h> */
25 #include <cmath>
26 #include <vector>
27 #include <map>
28 #include "ConfusionMatrix.h"
29 #include "base/Vector2d.h"
30
31
32 class CostFactory{
33 public:
34 CostFactory(void){};
35 CostFactory(unsigned short cv, short verbose) : m_cv(cv), m_verbose(verbose){};
36
37 virtual ~CostFactory(void){};
38 void setCv(unsigned short cv){m_cv=cv;};
39 void setClassValueMap(const std::string& classname, short classvalue){ m_classValueMap[classname]=classvalue;};
40 std::map<std::string,short> getClassValueMap(){return m_classValueMap;};
41 std::vector<std::string> getNameVector(){return m_nameVector;};
42 void setNameVector(std::vector<std::string>& nameVector){m_nameVector=nameVector;};
43 int getClassIndex(std::string classname) const {return m_cm.getClassIndex(classname);};
44 //pushBackClassName is for confusion matrix
45 void pushBackClassName(std::string classname){m_cm.pushBackClassName(classname,true);};//doSort=true
46 //pushBackName is for nameVector in CostFactory
47 void pushBackName(std::string classname){m_nameVector.push_back(classname);};
48 void setNcTraining(const std::vector<unsigned int> nctraining){m_nctraining=nctraining;};
49 void setNcTest(const std::vector<unsigned int> nctest){m_nctest=nctest;};
50 //getCost needs to be implemented case by case (e.g., SVM, ANN)
51 virtual double getCost(const std::vector<Vector2d<float> > &trainingFeatures)=0;
52
53 protected:
54 confusionmatrix::ConfusionMatrix m_cm;
55 std::map<std::string,short> m_classValueMap;
56 std::vector<std::string> m_nameVector;
57 std::vector<unsigned int> m_nctraining;
58 std::vector<unsigned int> m_nctest;
59 unsigned short m_cv;
60 /* std::string m_classname; */
61 short m_classvalue;
62 short m_verbose;
63 };
64 #endif