Skip to content

Commit 993ac89

Browse files
author
linyiqun
committed
ID3,C4.5分类决策树算法系列的java实现
ID3,C4.5分类决策树算法系列的java实现
1 parent a3e9898 commit 993ac89

File tree

5 files changed

+545
-0
lines changed

5 files changed

+545
-0
lines changed

DataMing_ID3/AttrNode.java

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package DataMing_ID3;
2+
3+
import java.util.ArrayList;
4+
5+
/**
6+
* 属性节点,不是叶子节点
7+
* @author lyq
8+
*
9+
*/
10+
public class AttrNode {
11+
//当前属性的名字
12+
private String attrName;
13+
//父节点的分类属性值
14+
private String parentAttrValue;
15+
//属性子节点
16+
private AttrNode[] childAttrNode;
17+
//孩子叶子节点
18+
private ArrayList<String> childDataIndex;
19+
20+
public String getAttrName() {
21+
return attrName;
22+
}
23+
24+
public void setAttrName(String attrName) {
25+
this.attrName = attrName;
26+
}
27+
28+
public AttrNode[] getChildAttrNode() {
29+
return childAttrNode;
30+
}
31+
32+
public void setChildAttrNode(AttrNode[] childAttrNode) {
33+
this.childAttrNode = childAttrNode;
34+
}
35+
36+
public String getParentAttrValue() {
37+
return parentAttrValue;
38+
}
39+
40+
public void setParentAttrValue(String parentAttrValue) {
41+
this.parentAttrValue = parentAttrValue;
42+
}
43+
44+
public ArrayList<String> getChildDataIndex() {
45+
return childDataIndex;
46+
}
47+
48+
public void setChildDataIndex(ArrayList<String> childDataIndex) {
49+
this.childDataIndex = childDataIndex;
50+
}
51+
}

DataMing_ID3/Client.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package DataMing_ID3;
2+
3+
/**
4+
* ID3决策树分类算法测试场景类
5+
* @author lyq
6+
*
7+
*/
8+
public class Client {
9+
public static void main(String[] args){
10+
String filePath = "C:\\Users\\lyq\\Desktop\\icon\\input.txt";
11+
12+
ID3Tool tool = new ID3Tool(filePath);
13+
tool.startBuildingTree(true);
14+
}
15+
}

DataMing_ID3/DataNode.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package DataMing_ID3;
2+
3+
/**
4+
* 存放数据的叶子节点
5+
* @author lyq
6+
*
7+
*/
8+
public class DataNode {
9+
/**
10+
* 数据的标号
11+
*/
12+
private int dataIndex;
13+
14+
public DataNode(int dataIndex){
15+
this.dataIndex = dataIndex;
16+
}
17+
}

0 commit comments

Comments
 (0)