Feat C++ API
A feature engineering automation tool
hillclimb.h
Go to the documentation of this file.
1 /* FEAT
2 copyright 2017 William La Cava
3 license: GNU/GPL v3
4 */
5 #ifndef HILLCLIMB_H
6 #define HILLCLIMB_H
7 
8 #include <Eigen/Dense>
9 #include <map>
10 #include <memory>
11 #include <vector>
12 #pragma GCC diagnostic push
13 #pragma GCC diagnostic ignored "-Wdeprecated"
14 #include <shogun/labels/Labels.h>
15 #pragma GCC diagnostic pop
16 
17 #include <string>
18 
19 #include "../pop/individual.h"
20 #include "../dat/data.h"
21 #include "../params.h"
22 
23 using std::map;
24 using std::shared_ptr;
25 using std::vector;
26 using Eigen::VectorXf;
27 using shogun::CLabels;
28 
29 namespace FT {
30 
31  namespace Opt{
32  class HillClimb
33  {
34  /* @class HillClimb
35  * @brief performs random weight updates and keeps them if they improve the cost function.
36  */
37  public:
38  typedef VectorXf (*callback)(const VectorXf&, shared_ptr<CLabels>&, const vector<float>&);
39 
40  std::map<string, callback> score_hash;
41 
42  HillClimb(string scorer, int iters=1, float step=0.1);
43 
45  shared_ptr<CLabels> run(Individual& ind, Data d,
46  const Parameters& params, bool& updated);
47 
48  private:
49  callback cost_func; //< scoring function
50  int iters; //< number of iterations
51  float step; //< percent of std dev to perturb weight by
52  };
53  }
54 
55 }
56 #endif
data holding X, y, and Z data
Definition: data.h:42
std::map< string, callback > score_hash
Definition: hillclimb.h:40
callback cost_func
Definition: hillclimb.h:49
shared_ptr< CLabels > run(Individual &ind, Data d, const Parameters &params, bool &updated)
adapt weights
Definition: hillclimb.cc:27
HillClimb(string scorer, int iters=1, float step=0.1)
Definition: hillclimb.cc:14
VectorXf(* callback)(const VectorXf &, shared_ptr< CLabels > &, const vector< float > &)
Definition: hillclimb.h:38
individual programs in the population
Definition: individual.h:31
main Feat namespace
Definition: data.cc:13
holds the hyperparameters for Feat.
Definition: params.h:25