zoukankan      html  css  js  c++  java
  • 第3章

    1.

    决策树理解比较简单,关键要自己把理论用笔实践一遍,推荐http://www.cise.ufl.edu/~ddd/cap6635/Fall-97/Short-papers/2.htm教程。自己把里面的数据用matlab或python辅助计算下。

    2.

    信息增益(Information Gain)和 (熵Entropy)

    3.

    list 3-1计算给定数据集的香农熵

    for featVec in dataSet:
            currentLabel=featVec[-1]
            if currentLabel not in labelCounts.keys():
                    labelCounts[currentLabel]=0   
                    labelCounts[currentLabel]+=1
            else:
                   labelCounts[currentLabel]+=1
    
    #中文书上的代码执行和理解起来有歧义,建议采用上述if---else语句。
    #或用原版的代码:
    if currentLabel not in labelCounts.keys():labelCounts[currentLabel]=0   
    labelCounts[currentLabel]+=1
    

      

    list 3-2按照给定特征划分数据集

    for featVec in dataSet 之后featVec是一个list,比如第一次循环后,featVec=[1,1,'yes'],featVec[0]是1.

  • 相关阅读:
    C++ reference
    C++ const 限定符
    POJ 1222 EXTENDED LIGHTS OUT(高斯消元)
    poj 2185
    poj 2406
    poj 2752
    hdu 6171
    hdu 6127
    uva 3708
    hdu 6092
  • 原文地址:https://www.cnblogs.com/cdsj/p/3538070.html
Copyright © 2011-2022 走看看