LearnTree(X, Y)
令 X 为 R x M 矩阵、R-datapoints 和 M-attributes,而 Y 具有 R 个元素,其中包含每个数据点的输出类。
j* = *argmaxj* **IG** j // (This is the splitting attribute we'll use)
IG 的最大值可以来自分类(基于文本)或实数(基于数字)属性。
--->如果它来自一个分类属性(j):对于第j个属性中的每个值v,我们将定义一个新矩阵,现在取X v 和 Y v 作为输入导出一个子树。
Xv = subset of all the rows of X in which Xij = v;
Yv = corresponding subset of Y values;
Child v = LearnTree(Xv, Yv);
PS:子树的数量将与第 j 个属性中唯一值 v 的数量相同
--->如果它来自实值属性 (j):我们需要找出最佳分割阈值
PS:阈值 t 与为该属性提供最大 IG 值的值相同
define IG(Y|X:t) as H(Y) - H(Y|X:t)
define H(Y|X:t) = H(Y|X<t) P(X<t) + H(Y|X>=t) P(X>=t)
define IG*(Y|X) = maxt IG(Y|X:t)
我们将拆分这个 t 值,然后通过定义两个新的 X t 和 Y t 对来定义两个 ChildTree .
X_lo = subset of all the rows whose Xij < t
Y_lo = corresponding subset Y values
Child_lo = LearnTree(X_lo, Y_lo)
X_hi = subset of all the rows whose Xij >t
Y_hi = corresponding subset Y values
Child_hi = LearnTree(X_hi, Y_hi)
拆分完成后,对数据进行分类。
欲了解更多信息,go here!
希望我回答了你的问题。