File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments