From f5b2b25d915507270c9c1d02752dc36e74bf23b0 Mon Sep 17 00:00:00 2001 From: lidapeng Date: Fri, 21 Feb 2020 18:21:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=B3=E7=AD=96=E6=A0=91=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AD=90=E8=8A=82=E7=82=B9=E7=B1=BB=E5=88=ABID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/wlld/randomForest/Tree.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/wlld/randomForest/Tree.java b/src/main/java/org/wlld/randomForest/Tree.java index c62da7f..412fa69 100644 --- a/src/main/java/org/wlld/randomForest/Tree.java +++ b/src/main/java/org/wlld/randomForest/Tree.java @@ -20,6 +20,7 @@ public class Tree {//决策树 private List fatherList;//父级样本 private Set attribute;//当前可用属性 private String key;//该节点分类属性 + private int typeId;//该节点该属性分类的Id值 private List nodeList;//下属节点 private int type; } @@ -108,6 +109,7 @@ public class Tree {//决策树 sonNode.attribute = nowAttribute; List list = entry.getValue(); sonNode.fatherList = list; + sonNode.typeId = entry.getKey(); int myNub = list.size(); double ent = getEnt(list); double dNub = ArithUtil.div(myNub, fatherNub); @@ -147,7 +149,7 @@ public class Tree {//决策树 return nodeList; } else { //判断类别 - node.isEnd = true; + node.isEnd = true;//叶子节点 node.type = getType(fatherList); return null; }