UFJF - Machine Learning Toolkit  0.51.8
featselect/FeatureSelection.hpp
1 //
2 // Created by Mateus Coutinho Marim on 6/26/2018.
3 //
4 
5 #pragma once
6 
7 #include "ufjfmltk/core/Data.hpp"
9 #include <memory>
10 
11 namespace mltk{
15  namespace featselect {
16  template<typename T>
19  protected:
21  std::shared_ptr<Data<T> > samples;
30 
32  const int MAX_DEPTH = 99999;
34  const int MAX_BREATH = 99999;
36  const double NUM_ERROR_EPS = 0.05;
38  int depth = 0;
40  int final_dim = 0;
42  int jump = 0;
44  int skip = 0;
46  bool leave_one_out = false;
48  int verbose = 0;
49 
50  public:
51 
56  virtual Data<T> selectFeatures() = 0;
57 
58  /*********************************************
59  * Setters *
60  *********************************************/
61 
66  void setSamples(const std::shared_ptr<Data<T> > &samples) { this->samples = samples; }
67  void setSamples(const Data<T>& samples) { this->samples = mltk::make_data<T>(samples); }
73  this->classifier = classifier;
74  this->classifier->setVerbose(0);
75  }
76 
81  void setFinalDimension(int final_dim) { this->final_dim = final_dim; }
82 
87  void setDepth(int depth) { this->depth = depth; }
88 
93  void setJump(int jump) { this->jump = jump; }
94 
99  void setSkip(int skip) { this->skip = skip; }
100 
105  void setVerbose(int verbose) { this->verbose = verbose; }
106 
112  };
113  }
114 }
void setVerbose(int _verbose)
Set the level of verbose.
Definition: Learner.hpp:175
Definition: Solution.hpp:13
Wrapper for the implementation of a simple timer.
Definition: Timer.hpp:16
Definition: classifier/Classifier.hpp:17
Definition: featselect/FeatureSelection.hpp:17
void setJump(int jump)
setJump Set the jump value.
Definition: featselect/FeatureSelection.hpp:93
void setSamples(const std::shared_ptr< Data< T > > &samples)
setSamples Set the samples used for the FeatureSelection.
Definition: featselect/FeatureSelection.hpp:66
void setCrossValidation(validation::CrossValidation *cv)
setCrossValidation Set the cross validation structure.
Definition: featselect/FeatureSelection.hpp:111
void setDepth(int depth)
setDepth Set the depth of the search.
Definition: featselect/FeatureSelection.hpp:87
Solution solution
Solution of the feature selection.
Definition: featselect/FeatureSelection.hpp:27
void setSkip(int skip)
setSkip Set the skip value.
Definition: featselect/FeatureSelection.hpp:99
void setVerbose(int verbose)
setVerbose Set the verbose level.
Definition: featselect/FeatureSelection.hpp:105
bool leave_one_out
Leave one out.
Definition: featselect/FeatureSelection.hpp:46
int skip
Number of levels to be skipped.
Definition: featselect/FeatureSelection.hpp:44
int depth
Depth of search.
Definition: featselect/FeatureSelection.hpp:38
int verbose
Verbose level.
Definition: featselect/FeatureSelection.hpp:48
Timer timer
Timer for time measuring.
Definition: featselect/FeatureSelection.hpp:29
classifier::Classifier< T > * classifier
Classifier used by the method.
Definition: featselect/FeatureSelection.hpp:23
void setClassifier(classifier::Classifier< T > *classifier)
setClassifier Set the classifier used for the FeatureSelection.
Definition: featselect/FeatureSelection.hpp:72
const int MAX_BREATH
Max breadth of search constant.
Definition: featselect/FeatureSelection.hpp:34
int final_dim
Final dimension.
Definition: featselect/FeatureSelection.hpp:40
const int MAX_DEPTH
Max depth of search constant.
Definition: featselect/FeatureSelection.hpp:32
validation::CrossValidation * cv
Structure to hold the cross-validation result.
Definition: featselect/FeatureSelection.hpp:25
virtual Data< T > selectFeatures()=0
Function that executes the feature selection phase.
const double NUM_ERROR_EPS
Error tolerance constant.
Definition: featselect/FeatureSelection.hpp:36
std::shared_ptr< Data< T > > samples
Attributes.
Definition: featselect/FeatureSelection.hpp:21
int jump
Jump size.
Definition: featselect/FeatureSelection.hpp:42
void setFinalDimension(int final_dim)
setFinalDimension Set the classifier used for the FeatureSelection.
Definition: featselect/FeatureSelection.hpp:81
UFJF-MLTK main namespace for core functionalities.
Definition: classifier/Classifier.hpp:11
Structure to manage cross validation.
Definition: valid/Validation.hpp:62