-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathID3.h
45 lines (34 loc) · 1.2 KB
/
ID3.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
#ifndef __ClASSIFY_TREE_H__
#define __CLASSIFY_TREE_H__
#include "BaseTree.h"
#include "Feature.h"
namespace mla {
namespace tree {
class ID3 : public mla::basic::Tree<float> {
public:
ID3() {}
ID3(int32_t maxNodeCnt,
int32_t maxDepth,
bool isMultiThreadOn,
int32_t labelCnt,
bool ensemble) : mla::basic::Tree<float>(maxNodeCnt, maxDepth, isMultiThreadOn, labelCnt, ensemble) {}
void optSplitPos(int &nOptFeatureIndex,
float &nOptFeatureVal,
std::vector<int32_t> &vCurrentIndex,
std::vector<int32_t> &vFeatureIndex);
void optSplitPosMultiThread(int &nOptFeatureIndex,
float &nOptFeatureVal,
std::vector<int32_t> &vCurrentIndex,
std::vector<int32_t> &vFeatureIndex);
void splitData(struct mla::basic::Node<float>* &node,
const int &nOptFeatureIndex,
const float &fOptFeatureVal,
const std::vector<int32_t> &vTempCurrentIndex,
std::vector<int32_t> &vLeftIndex,
std::vector<int32_t> &vRightIndex);
friend void* selectFeatureFuncC(void* param);
float predict(const std::vector<float> &testFeatureX);
};
}
}
#endif