Chisel
ProbabilisticModel.h
Go to the documentation of this file.
1 #ifndef PROBABILISTIC_MODEL_H_
2 #define PROBABILISTIC_MODEL_H_
3 
4 #include <vector>
5 
6 #include "clang/AST/ASTContext.h"
7 
8 #include <mlpack/core.hpp>
9 #include <mlpack/methods/decision_tree/decision_tree.hpp>
10 
11 using DDElement = llvm::PointerUnion<clang::Decl *, clang::Stmt *>;
12 using DDElementVector = std::vector<DDElement>;
13 
16 public:
17  ProbabilisticModel() : MyDecisionTree(2) {}
18  void initialize(DDElementVector &Source);
19  void clear();
20  void train(int Iteration);
21  void addForTraining(DDElementVector &Source, DDElementVector &Chunk,
22  bool Label);
23  arma::uvec sortCandidates(DDElementVector &Source,
24  std::vector<DDElementVector> &Chunks);
25 
26 private:
27  arma::mat TrainingSet;
28  arma::Row<size_t> TrainingLabels;
29  mlpack::tree::DecisionTree<> MyDecisionTree;
30 
31  arma::mat createFeatureVector(DDElementVector &Source,
32  DDElementVector &Chunk);
33  void printVector(arma::mat FeatureVector, bool Label);
34 };
35 
36 #endif // PROBABILISTIC_MODEL_H_
Represents the probabilistic model that is utilized in the reduction phase.
Definition: ProbabilisticModel.h:15
void addForTraining(DDElementVector &Source, DDElementVector &Chunk, bool Label)
Definition: ProbabilisticModel.cpp:41
arma::uvec sortCandidates(DDElementVector &Source, std::vector< DDElementVector > &Chunks)
Definition: ProbabilisticModel.cpp:55
std::vector< DDElement > DDElementVector
Definition: ProbabilisticModel.h:12
ProbabilisticModel()
Definition: ProbabilisticModel.h:17
void clear()
Definition: ProbabilisticModel.cpp:21
void train(int Iteration)
Definition: ProbabilisticModel.cpp:28
void initialize(DDElementVector &Source)
Definition: ProbabilisticModel.cpp:13
llvm::PointerUnion< clang::Decl *, clang::Stmt * > DDElement
Definition: ProbabilisticModel.h:11