-
Notifications
You must be signed in to change notification settings - Fork 6
/
RandomTTForest.h
65 lines (55 loc) · 1.68 KB
/
RandomTTForest.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* RandomTTForest.h
* TTree
*
* Created by Vincent Botta on 05/03/09.
* Copyright 2009 University of Liège. All rights reserved.
*
*/
#ifndef __RANDOMTTFOREST__
#define __RANDOMTTFOREST__
#include "GroupLearner.h"
#include "ClassicTree.h"
#include "ClassicNodeTree.h"
class RandomTTForest : public GroupLearner {
private:
unsigned int nbtree;
ClassicNodeTree **term;
unsigned int k;
FILE* _treeinfo; // 27-07-2012
public:
RandomTTForest(DB *db, int t = 1, int k = 0, int n = 1);
~RandomTTForest();
double learn();
Result test();
Result test(unsigned int obj);
void test(Result &result, unsigned int obj);
Result test(std::vector<unsigned int> *set);
Result test(int t, std::vector<unsigned int> *set); // 27-07-2012
Result testnmin(std::vector<unsigned int> *set, int nmin = 1, int t = 0); // 02-08-2012
void computeVimp();
//void computeVimp(std::vector<float> &vim);
void computeVimp(std::vector<float> &vim, std::vector<unsigned int> &set);
void computeGroupVimp();
//void computeGroupVimp(std::vector<float> &gim);
void computeGroupVimp(std::vector<float> &gim, std::vector<unsigned int> &set);
void setTreeInfo(FILE* ti) { _treeinfo = ti; } // 27-07-2012
void print(FILE* out = stdout) const {
GroupLearner::print(out);
fprintf(out,"RANDOMTTFOREST\n");
fprintf(out,"NbTree = %d\n",nbtree);
//for (int i = 0 ; i < nbtree ; ++i) {
// fprintf(out,"___________________TREE %d INFOS\n",i+1);
// term[i]->print(out);
//}
}
void dotit(FILE* out = stdout, int maxt = 0) {
if (maxt == 0 || maxt > nbtree) { maxt = nbtree; }
fprintf(out,"digraph G {\n");
for (int i = 0 ; i < maxt ; ++i) {
term[i]->dotit(out);
}
fprintf(out,"}\n");
}
};
#endif