ML之DT:基于简单回归问题训练决策树(DIY数据集+三种深度的二元DT性能比较)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_41185868/article/details/85931868

ML之DT:基于简单回归问题训练决策树(DIY数据集+三种深度的二元DT性能比较)

输出结果

设计思路

核心代码

for i in range(1, len(xPlot)):
    lhList = list(xPlot[0:i])
    rhList = list(xPlot[i:len(xPlot)])

    lhAvg = sum(lhList) / len(lhList)
    rhAvg = sum(rhList) / len(rhList)

    lhSse = sum([(s - lhAvg) * (s - lhAvg) for s in lhList])
    rhSse = sum([(s - rhAvg) * (s - rhAvg) for s in rhList])

    sse.append(lhSse + rhSse)
    xMin.append(max(lhList))

猜你喜欢

转载自blog.csdn.net/qq_41185868/article/details/85931868