mat1#求总方差defregErr(dataSet):returnvar(dataSet[:,-1]) * shape(dataSet)[0]defregLeaf(dataSet):returnmean(dataSet[:,-1])#返回叶节点,回归树中的目标变量的均值defcreateTree(dataSet, leafType = regLeaf, errType = regErr, ops=(1,4)): ...