案例-使用决策树预测隐性眼镜类型

  • 收集数据:提供的文本文件
  • 准备数据:解析tab键分割的数据
  • 分析数据:快速检查数据
  • 训练算法:
  • 测试算法:编写测试函数 验证决策树可以正确分类给定的数据实例
  • 使用算法:存储树的数据结构,以便下次使用
from math import log
import operator
def calcShannonEnt(dataSet):
    numEntries = len(dataSet)
    # 为所有可能分类创建字典
    labelCounts= {}
    for featVec in dataSet:
        currentLabel = featVec[-1]
        if currentLabel not in labelCounts.keys():
            labelCounts[currentLabel] = 0
        labelCounts[currentLabel] += 1
    shannonEnt = 0.0
    for key in labelCounts:
        prob = float(labelCounts[key])/numEntries
        shannonEnt -= prob * log(prob,2)   # 以 2为底求对数
    return shannonEnt     
# 按照给定特征划分数据集
# 输入参数: 待划分待数据集、划分数据集的特征、需要返回的特征的值
def splitDataSet(dataSet,axis,value):
    retDataSet = []
    for featVec in dataSet:
        print("featVec",featVec)
        if featVec[axis] == value:
            print("axis",axis,"featVec[axis]",featVec[axis])
            reducedFeatVec = featVec[:axis]
            print("axis",axis,"reducedFeatVec:",reducedFeatVec)
            reducedFeatVec.extend(featVec[axis+1:])
            print("featVec[axis+1:]",featVec[axis+1:])
            print("axis",axis,"reducedFeatVec:",reducedFeatVec)
            retDataSet.append(reducedFeatVec)
    return retDataSet
# 选择最好的数据集划分方式
def chooseBestFeatureToSplit(dataSet):
    numFeatures = len(dataSet[0])-1  #特征的个数
    baseEntropy = calcShannonEnt(dataSet) # 基线熵
    print("baseEntropy:",baseEntropy)
    bestInfoGain = 0.0
    bestFeature = -1
    # 创建唯一的分类标签
    for i in range(numFeatures):
        featList = [example[i] for example in dataSet]
        print("featList:",featList)
        uniqueVals =  set(featList)
        print("uniqueVals:",uniqueVals)

        # 计算每种划分方式的信息熵
        newEntropy = 0.0
        for value in uniqueVals:
            subDataSet = splitDataSet(dataSet, i ,value)
            prob = len(subDataSet) / float(len(dataSet))
            newEntropy += prob * calcShannonEnt(subDataSet)
        infoGain = baseEntropy - newEntropy  # 计算信息增益
        print("baseEntropy",baseEntropy,"i:",i,"newEntropy",newEntropy,"infoGain",infoGain)
        if(infoGain > bestInfoGain):
            bestInfoGain = infoGain   # 计算最好的信息增益
            bestFeature = i
    return bestFeature
def majorityCnt(classList):
    classCount = {}
    for vote in classCount:
        if vote not in classCount.keys():
            classCount[vote] =0
        classCount[vote] += 1
    sortedClassCount = sorted(classCount.items(), key=operator.itemgetter(1), reverse =True)
    return sortedClassCount[0][0]
# 创建决策树
def createTree(dataSet,labels):
    classList = [example[-1] for example in dataSet]
    print("labels:",labels)
    print("classList:",classList)
    print("classList[0]:",classList[0])
    print("classList.count(classList[0]):",classList.count(classList[0]))

    ## 类别相同则停止划分
    if classList.count(classList[0]) == len(classList):
        return classList[0]

    ## 遍历完所有特征时 返回出现次数最多的
    if len(dataSet[0]) == 1:
        return majorityCnt(classList)

    bestFeat = chooseBestFeatureToSplit(dataSet)
    bestFeatLabel = labels[bestFeat] 
    print("bestFeatLabel",bestFeatLabel)
    myTree = {bestFeatLabel:{}}
    print("myTree:::",myTree)
    del(labels[bestFeat])
    print("labels:",labels)
    featValues = [example[bestFeat] for example in dataSet]
    uniqueVals = set(featValues)
    for value in uniqueVals:
        subLabels = labels[:]
        print("subLabels:",subLabels)
        myTree[bestFeatLabel][value] = createTree(splitDataSet(dataSet, bestFeat, value),subLabels)
    return myTree
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
simheifont = FontProperties(fname='../simhei.ttf')
decisionNode = dict(boxstyle="sawtooth", fc="0.8")
leafNode = dict(boxstyle="round4", fc="0.8")
arrow_args = dict(arrowstyle="<-")
def plotNode(nodeTxt,centerPt,parentPt,nodeType):
    createPlot.ax1.annotate(nodeTxt,xy=parentPt, xycoords='axes fraction', 
                            xytext=centerPt, textcoords ='axes fraction',
                            va="center",ha="center",bbox=nodeType, arrowprops=arrow_args,
                            fontproperties= simheifont)
# 获取叶节点和树的层数
def getNumLeafs(myTree):
    numLeafs = 0
    firstStr = list(myTree.keys())[0]
    secondDict = myTree[firstStr]
    for key in secondDict.keys():
        if type(secondDict[key]).__name__ == 'dict':   ## 测试节点的数据类型是否字典
            numLeafs += getNumLeafs(secondDict[key])
        else:
            numLeafs += 1
    return numLeafs

def getTreeDepth(myTree):
    maxDepth = 0
    firstStr = list(myTree.keys())[0]
    secondDict = myTree[firstStr]
    for key in secondDict.keys():
        if type(secondDict[key]).__name__ == 'dict':   ## 测试节点的数据类型是否字典
            thisDepth = 1 + getTreeDepth(secondDict[key])
        else:
            thisDepth = 1
        if thisDepth > maxDepth:
            maxDepth = thisDepth
    return maxDepth
def plotMidText(cntrPt, parentPt, txtString):
    xMid = (parentPt[0] - cntrPt[0]) /2.0 + cntrPt[0]
    yMid = (parentPt[1] - cntrPt[1]) /2.0 + cntrPt[1]
    createPlot.ax1.text(xMid,yMid, txtString)

def plotTree(myTree, parentPt, nodeText):
    numLeafs = getNumLeafs(myTree)
    depth = getTreeDepth(myTree)

    firstStr = list(myTree.keys())[0]
    cntrPt = (plotTree.xOff + (1.0 + float(numLeafs)) /2.0 / plotTree.totalW, plotTree.yOff)
    plotMidText(cntrPt, parentPt, nodeText)
    plotNode(firstStr, cntrPt, parentPt, decisionNode)

    secondDict = myTree[firstStr]
    plotTree.yOff = plotTree.yOff - 1.0 / plotTree.totalD
    for key in secondDict.keys():
        if type(secondDict[key]).__name__ == 'dict':
            plotTree(secondDict[key], cntrPt, str(key))
        else:
            plotTree.xOff = plotTree.xOff + 1.0 / plotTree.totalW
            plotNode(secondDict[key], (plotTree.xOff, plotTree.yOff), cntrPt, leafNode)
            plotMidText((plotTree.xOff, plotTree.yOff), cntrPt,str(key))
    plotTree.yOff = plotTree.yOff + 1.0 / plotTree.totalD

def createPlot(inTree):
    fig = plt.figure(1, facecolor='white')
    fig.clf()
    axprops = dict(xticks=[], yticks=[])
    createPlot.ax1 = plt.subplot(111, frameon=False, **axprops)
    plotTree.totalW = float(getNumLeafs(inTree))
    plotTree.totalD = float(getTreeDepth(inTree))
    plotTree.xOff = - 0.5/ plotTree.totalW
    plotTree.yOff = 1.0
    plotTree(inTree,(0.5,1.0),'')
    plt.show()
# 使用决策树的分类函数
def classify(inputTree,featLabels, testVec):
    firstStr = list(inputTree.keys())[0]
    secondDict = inputTree[firstStr]
    featIndex = featLabels.index(firstStr)
    print(featIndex)

    for key in secondDict.keys():
        if testVec[featIndex] == key:
            if type(secondDict[key]).__name__ == 'dict':
                classLabel = classify(secondDict[key], featLabels, testVec)
            else:
                classLabel = secondDict[key]
    return classLabel
def storeTree(inputTree,fileName):
    import _pickle as cPickle
    fw = open(fileName, 'w')
    cPickle.dump(inputTree,fw)
    fw.close()

def grabTree(fileName):
    import _pickle as cPickle
    fr = open(fileName)
    return cPickle.load(fr)
with open("./dataset/lenses.txt",'r') as fr:
    lenses = [inst.strip().split('\t')  for inst in fr.readlines()]
    print(lenses)
    lensesLabels = ['age','prescript','astigmatic','tearRate']
    lensesTree = createTree(lenses,lensesLabels)
    lensesTree
[['young', 'myope', 'no', 'reduced', 'no lenses'], ['young', 'myope', 'no', 'normal', 'soft'], ['young', 'myope', 'yes', 'reduced', 'no lenses'], ['young', 'myope', 'yes', 'normal', 'hard'], ['young', 'hyper', 'no', 'reduced', 'no lenses'], ['young', 'hyper', 'no', 'normal', 'soft'], ['young', 'hyper', 'yes', 'reduced', 'no lenses'], ['young', 'hyper', 'yes', 'normal', 'hard'], ['pre', 'myope', 'no', 'reduced', 'no lenses'], ['pre', 'myope', 'no', 'normal', 'soft'], ['pre', 'myope', 'yes', 'reduced', 'no lenses'], ['pre', 'myope', 'yes', 'normal', 'hard'], ['pre', 'hyper', 'no', 'reduced', 'no lenses'], ['pre', 'hyper', 'no', 'normal', 'soft'], ['pre', 'hyper', 'yes', 'reduced', 'no lenses'], ['pre', 'hyper', 'yes', 'normal', 'no lenses'], ['presbyopic', 'myope', 'no', 'reduced', 'no lenses'], ['presbyopic', 'myope', 'no', 'normal', 'no lenses'], ['presbyopic', 'myope', 'yes', 'reduced', 'no lenses'], ['presbyopic', 'myope', 'yes', 'normal', 'hard'], ['presbyopic', 'hyper', 'no', 'reduced', 'no lenses'], ['presbyopic', 'hyper', 'no', 'normal', 'soft'], ['presbyopic', 'hyper', 'yes', 'reduced', 'no lenses'], ['presbyopic', 'hyper', 'yes', 'normal', 'no lenses']]
labels: ['age', 'prescript', 'astigmatic', 'tearRate']
classList: ['no lenses', 'soft', 'no lenses', 'hard', 'no lenses', 'soft', 'no lenses', 'hard', 'no lenses', 'soft', 'no lenses', 'hard', 'no lenses', 'soft', 'no lenses', 'no lenses', 'no lenses', 'no lenses', 'no lenses', 'hard', 'no lenses', 'soft', 'no lenses', 'no lenses']
classList[0]: no lenses
classList.count(classList[0]): 15
baseEntropy: 1.3260875253642983
featList: ['young', 'young', 'young', 'young', 'young', 'young', 'young', 'young', 'pre', 'pre', 'pre', 'pre', 'pre', 'pre', 'pre', 'pre', 'presbyopic', 'presbyopic', 'presbyopic', 'presbyopic', 'presbyopic', 'presbyopic', 'presbyopic', 'presbyopic']
uniqueVals: {'young', 'pre', 'presbyopic'}
featVec ['young', 'myope', 'no', 'reduced', 'no lenses']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'no', 'reduced', 'no lenses']
axis 0 reducedFeatVec: ['myope', 'no', 'reduced', 'no lenses']
featVec ['young', 'myope', 'no', 'normal', 'soft']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'no', 'normal', 'soft']
axis 0 reducedFeatVec: ['myope', 'no', 'normal', 'soft']
featVec ['young', 'myope', 'yes', 'reduced', 'no lenses']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'yes', 'reduced', 'no lenses']
axis 0 reducedFeatVec: ['myope', 'yes', 'reduced', 'no lenses']
featVec ['young', 'myope', 'yes', 'normal', 'hard']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'yes', 'normal', 'hard']
axis 0 reducedFeatVec: ['myope', 'yes', 'normal', 'hard']
featVec ['young', 'hyper', 'no', 'reduced', 'no lenses']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'no', 'reduced', 'no lenses']
axis 0 reducedFeatVec: ['hyper', 'no', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'no', 'normal', 'soft']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'no', 'normal', 'soft']
axis 0 reducedFeatVec: ['hyper', 'no', 'normal', 'soft']
featVec ['young', 'hyper', 'yes', 'reduced', 'no lenses']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'yes', 'reduced', 'no lenses']
axis 0 reducedFeatVec: ['hyper', 'yes', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'yes', 'normal', 'hard']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'yes', 'normal', 'hard']
axis 0 reducedFeatVec: ['hyper', 'yes', 'normal', 'hard']
featVec ['pre', 'myope', 'no', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'no', 'normal', 'soft']
featVec ['pre', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'yes', 'normal', 'hard']
featVec ['pre', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'no', 'normal', 'soft']
featVec ['pre', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'yes', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'normal', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'no', 'normal', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'yes', 'normal', 'no lenses']
featVec ['young', 'myope', 'no', 'reduced', 'no lenses']
featVec ['young', 'myope', 'no', 'normal', 'soft']
featVec ['young', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['young', 'myope', 'yes', 'normal', 'hard']
featVec ['young', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'no', 'normal', 'soft']
featVec ['young', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'yes', 'normal', 'hard']
featVec ['pre', 'myope', 'no', 'reduced', 'no lenses']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'no', 'reduced', 'no lenses']
axis 0 reducedFeatVec: ['myope', 'no', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'no', 'normal', 'soft']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'no', 'normal', 'soft']
axis 0 reducedFeatVec: ['myope', 'no', 'normal', 'soft']
featVec ['pre', 'myope', 'yes', 'reduced', 'no lenses']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'yes', 'reduced', 'no lenses']
axis 0 reducedFeatVec: ['myope', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'yes', 'normal', 'hard']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'yes', 'normal', 'hard']
axis 0 reducedFeatVec: ['myope', 'yes', 'normal', 'hard']
featVec ['pre', 'hyper', 'no', 'reduced', 'no lenses']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'no', 'reduced', 'no lenses']
axis 0 reducedFeatVec: ['hyper', 'no', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'no', 'normal', 'soft']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'no', 'normal', 'soft']
axis 0 reducedFeatVec: ['hyper', 'no', 'normal', 'soft']
featVec ['pre', 'hyper', 'yes', 'reduced', 'no lenses']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'yes', 'reduced', 'no lenses']
axis 0 reducedFeatVec: ['hyper', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'yes', 'normal', 'no lenses']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'yes', 'normal', 'no lenses']
axis 0 reducedFeatVec: ['hyper', 'yes', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'normal', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'no', 'normal', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'yes', 'normal', 'no lenses']
featVec ['young', 'myope', 'no', 'reduced', 'no lenses']
featVec ['young', 'myope', 'no', 'normal', 'soft']
featVec ['young', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['young', 'myope', 'yes', 'normal', 'hard']
featVec ['young', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'no', 'normal', 'soft']
featVec ['young', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'yes', 'normal', 'hard']
featVec ['pre', 'myope', 'no', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'no', 'normal', 'soft']
featVec ['pre', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'yes', 'normal', 'hard']
featVec ['pre', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'no', 'normal', 'soft']
featVec ['pre', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'yes', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'reduced', 'no lenses']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'no', 'reduced', 'no lenses']
axis 0 reducedFeatVec: ['myope', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'normal', 'no lenses']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'no', 'normal', 'no lenses']
axis 0 reducedFeatVec: ['myope', 'no', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'reduced', 'no lenses']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'yes', 'reduced', 'no lenses']
axis 0 reducedFeatVec: ['myope', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'normal', 'hard']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'yes', 'normal', 'hard']
axis 0 reducedFeatVec: ['myope', 'yes', 'normal', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'reduced', 'no lenses']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'no', 'reduced', 'no lenses']
axis 0 reducedFeatVec: ['hyper', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'no', 'normal', 'soft']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'no', 'normal', 'soft']
axis 0 reducedFeatVec: ['hyper', 'no', 'normal', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'reduced', 'no lenses']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'yes', 'reduced', 'no lenses']
axis 0 reducedFeatVec: ['hyper', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'yes', 'normal', 'no lenses']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'yes', 'normal', 'no lenses']
axis 0 reducedFeatVec: ['hyper', 'yes', 'normal', 'no lenses']
baseEntropy 1.3260875253642983 i: 0 newEntropy 1.286691021718177 infoGain 0.03939650364612124
featList: ['myope', 'myope', 'myope', 'myope', 'hyper', 'hyper', 'hyper', 'hyper', 'myope', 'myope', 'myope', 'myope', 'hyper', 'hyper', 'hyper', 'hyper', 'myope', 'myope', 'myope', 'myope', 'hyper', 'hyper', 'hyper', 'hyper']
uniqueVals: {'myope', 'hyper'}
featVec ['young', 'myope', 'no', 'reduced', 'no lenses']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['no', 'reduced', 'no lenses']
axis 1 reducedFeatVec: ['young', 'no', 'reduced', 'no lenses']
featVec ['young', 'myope', 'no', 'normal', 'soft']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['no', 'normal', 'soft']
axis 1 reducedFeatVec: ['young', 'no', 'normal', 'soft']
featVec ['young', 'myope', 'yes', 'reduced', 'no lenses']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['yes', 'reduced', 'no lenses']
axis 1 reducedFeatVec: ['young', 'yes', 'reduced', 'no lenses']
featVec ['young', 'myope', 'yes', 'normal', 'hard']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['yes', 'normal', 'hard']
axis 1 reducedFeatVec: ['young', 'yes', 'normal', 'hard']
featVec ['young', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'no', 'normal', 'soft']
featVec ['young', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'yes', 'normal', 'hard']
featVec ['pre', 'myope', 'no', 'reduced', 'no lenses']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['no', 'reduced', 'no lenses']
axis 1 reducedFeatVec: ['pre', 'no', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'no', 'normal', 'soft']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['no', 'normal', 'soft']
axis 1 reducedFeatVec: ['pre', 'no', 'normal', 'soft']
featVec ['pre', 'myope', 'yes', 'reduced', 'no lenses']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['yes', 'reduced', 'no lenses']
axis 1 reducedFeatVec: ['pre', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'yes', 'normal', 'hard']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['yes', 'normal', 'hard']
axis 1 reducedFeatVec: ['pre', 'yes', 'normal', 'hard']
featVec ['pre', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'no', 'normal', 'soft']
featVec ['pre', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'yes', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'reduced', 'no lenses']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['no', 'reduced', 'no lenses']
axis 1 reducedFeatVec: ['presbyopic', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'normal', 'no lenses']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['no', 'normal', 'no lenses']
axis 1 reducedFeatVec: ['presbyopic', 'no', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'reduced', 'no lenses']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['yes', 'reduced', 'no lenses']
axis 1 reducedFeatVec: ['presbyopic', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'normal', 'hard']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['yes', 'normal', 'hard']
axis 1 reducedFeatVec: ['presbyopic', 'yes', 'normal', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'no', 'normal', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'yes', 'normal', 'no lenses']
featVec ['young', 'myope', 'no', 'reduced', 'no lenses']
featVec ['young', 'myope', 'no', 'normal', 'soft']
featVec ['young', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['young', 'myope', 'yes', 'normal', 'hard']
featVec ['young', 'hyper', 'no', 'reduced', 'no lenses']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['no', 'reduced', 'no lenses']
axis 1 reducedFeatVec: ['young', 'no', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'no', 'normal', 'soft']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['no', 'normal', 'soft']
axis 1 reducedFeatVec: ['young', 'no', 'normal', 'soft']
featVec ['young', 'hyper', 'yes', 'reduced', 'no lenses']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['yes', 'reduced', 'no lenses']
axis 1 reducedFeatVec: ['young', 'yes', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'yes', 'normal', 'hard']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['yes', 'normal', 'hard']
axis 1 reducedFeatVec: ['young', 'yes', 'normal', 'hard']
featVec ['pre', 'myope', 'no', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'no', 'normal', 'soft']
featVec ['pre', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'yes', 'normal', 'hard']
featVec ['pre', 'hyper', 'no', 'reduced', 'no lenses']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['no', 'reduced', 'no lenses']
axis 1 reducedFeatVec: ['pre', 'no', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'no', 'normal', 'soft']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['no', 'normal', 'soft']
axis 1 reducedFeatVec: ['pre', 'no', 'normal', 'soft']
featVec ['pre', 'hyper', 'yes', 'reduced', 'no lenses']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['yes', 'reduced', 'no lenses']
axis 1 reducedFeatVec: ['pre', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'yes', 'normal', 'no lenses']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['yes', 'normal', 'no lenses']
axis 1 reducedFeatVec: ['pre', 'yes', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'normal', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'reduced', 'no lenses']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['no', 'reduced', 'no lenses']
axis 1 reducedFeatVec: ['presbyopic', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'no', 'normal', 'soft']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['no', 'normal', 'soft']
axis 1 reducedFeatVec: ['presbyopic', 'no', 'normal', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'reduced', 'no lenses']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['yes', 'reduced', 'no lenses']
axis 1 reducedFeatVec: ['presbyopic', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'yes', 'normal', 'no lenses']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['yes', 'normal', 'no lenses']
axis 1 reducedFeatVec: ['presbyopic', 'yes', 'normal', 'no lenses']
baseEntropy 1.3260875253642983 i: 1 newEntropy 1.2865766899407325 infoGain 0.039510835423565815
featList: ['no', 'no', 'yes', 'yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes', 'yes']
uniqueVals: {'yes', 'no'}
featVec ['young', 'myope', 'no', 'reduced', 'no lenses']
featVec ['young', 'myope', 'no', 'normal', 'soft']
featVec ['young', 'myope', 'yes', 'reduced', 'no lenses']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['young', 'myope']
featVec[axis+1:] ['reduced', 'no lenses']
axis 2 reducedFeatVec: ['young', 'myope', 'reduced', 'no lenses']
featVec ['young', 'myope', 'yes', 'normal', 'hard']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['young', 'myope']
featVec[axis+1:] ['normal', 'hard']
axis 2 reducedFeatVec: ['young', 'myope', 'normal', 'hard']
featVec ['young', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'no', 'normal', 'soft']
featVec ['young', 'hyper', 'yes', 'reduced', 'no lenses']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['young', 'hyper']
featVec[axis+1:] ['reduced', 'no lenses']
axis 2 reducedFeatVec: ['young', 'hyper', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'yes', 'normal', 'hard']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['young', 'hyper']
featVec[axis+1:] ['normal', 'hard']
axis 2 reducedFeatVec: ['young', 'hyper', 'normal', 'hard']
featVec ['pre', 'myope', 'no', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'no', 'normal', 'soft']
featVec ['pre', 'myope', 'yes', 'reduced', 'no lenses']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['pre', 'myope']
featVec[axis+1:] ['reduced', 'no lenses']
axis 2 reducedFeatVec: ['pre', 'myope', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'yes', 'normal', 'hard']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['pre', 'myope']
featVec[axis+1:] ['normal', 'hard']
axis 2 reducedFeatVec: ['pre', 'myope', 'normal', 'hard']
featVec ['pre', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'no', 'normal', 'soft']
featVec ['pre', 'hyper', 'yes', 'reduced', 'no lenses']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['pre', 'hyper']
featVec[axis+1:] ['reduced', 'no lenses']
axis 2 reducedFeatVec: ['pre', 'hyper', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'yes', 'normal', 'no lenses']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['pre', 'hyper']
featVec[axis+1:] ['normal', 'no lenses']
axis 2 reducedFeatVec: ['pre', 'hyper', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'reduced', 'no lenses']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['presbyopic', 'myope']
featVec[axis+1:] ['reduced', 'no lenses']
axis 2 reducedFeatVec: ['presbyopic', 'myope', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'normal', 'hard']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['presbyopic', 'myope']
featVec[axis+1:] ['normal', 'hard']
axis 2 reducedFeatVec: ['presbyopic', 'myope', 'normal', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'no', 'normal', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'reduced', 'no lenses']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['presbyopic', 'hyper']
featVec[axis+1:] ['reduced', 'no lenses']
axis 2 reducedFeatVec: ['presbyopic', 'hyper', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'yes', 'normal', 'no lenses']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['presbyopic', 'hyper']
featVec[axis+1:] ['normal', 'no lenses']
axis 2 reducedFeatVec: ['presbyopic', 'hyper', 'normal', 'no lenses']
featVec ['young', 'myope', 'no', 'reduced', 'no lenses']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['young', 'myope']
featVec[axis+1:] ['reduced', 'no lenses']
axis 2 reducedFeatVec: ['young', 'myope', 'reduced', 'no lenses']
featVec ['young', 'myope', 'no', 'normal', 'soft']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['young', 'myope']
featVec[axis+1:] ['normal', 'soft']
axis 2 reducedFeatVec: ['young', 'myope', 'normal', 'soft']
featVec ['young', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['young', 'myope', 'yes', 'normal', 'hard']
featVec ['young', 'hyper', 'no', 'reduced', 'no lenses']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['young', 'hyper']
featVec[axis+1:] ['reduced', 'no lenses']
axis 2 reducedFeatVec: ['young', 'hyper', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'no', 'normal', 'soft']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['young', 'hyper']
featVec[axis+1:] ['normal', 'soft']
axis 2 reducedFeatVec: ['young', 'hyper', 'normal', 'soft']
featVec ['young', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'yes', 'normal', 'hard']
featVec ['pre', 'myope', 'no', 'reduced', 'no lenses']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['pre', 'myope']
featVec[axis+1:] ['reduced', 'no lenses']
axis 2 reducedFeatVec: ['pre', 'myope', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'no', 'normal', 'soft']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['pre', 'myope']
featVec[axis+1:] ['normal', 'soft']
axis 2 reducedFeatVec: ['pre', 'myope', 'normal', 'soft']
featVec ['pre', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'yes', 'normal', 'hard']
featVec ['pre', 'hyper', 'no', 'reduced', 'no lenses']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['pre', 'hyper']
featVec[axis+1:] ['reduced', 'no lenses']
axis 2 reducedFeatVec: ['pre', 'hyper', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'no', 'normal', 'soft']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['pre', 'hyper']
featVec[axis+1:] ['normal', 'soft']
axis 2 reducedFeatVec: ['pre', 'hyper', 'normal', 'soft']
featVec ['pre', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'yes', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'reduced', 'no lenses']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['presbyopic', 'myope']
featVec[axis+1:] ['reduced', 'no lenses']
axis 2 reducedFeatVec: ['presbyopic', 'myope', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'normal', 'no lenses']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['presbyopic', 'myope']
featVec[axis+1:] ['normal', 'no lenses']
axis 2 reducedFeatVec: ['presbyopic', 'myope', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'normal', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'reduced', 'no lenses']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['presbyopic', 'hyper']
featVec[axis+1:] ['reduced', 'no lenses']
axis 2 reducedFeatVec: ['presbyopic', 'hyper', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'no', 'normal', 'soft']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['presbyopic', 'hyper']
featVec[axis+1:] ['normal', 'soft']
axis 2 reducedFeatVec: ['presbyopic', 'hyper', 'normal', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'yes', 'normal', 'no lenses']
baseEntropy 1.3260875253642983 i: 2 newEntropy 0.9490822953528211 infoGain 0.37700523001147723
featList: ['reduced', 'normal', 'reduced', 'normal', 'reduced', 'normal', 'reduced', 'normal', 'reduced', 'normal', 'reduced', 'normal', 'reduced', 'normal', 'reduced', 'normal', 'reduced', 'normal', 'reduced', 'normal', 'reduced', 'normal', 'reduced', 'normal']
uniqueVals: {'reduced', 'normal'}
featVec ['young', 'myope', 'no', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['young', 'myope', 'no']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['young', 'myope', 'no', 'no lenses']
featVec ['young', 'myope', 'no', 'normal', 'soft']
featVec ['young', 'myope', 'yes', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['young', 'myope', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['young', 'myope', 'yes', 'no lenses']
featVec ['young', 'myope', 'yes', 'normal', 'hard']
featVec ['young', 'hyper', 'no', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['young', 'hyper', 'no']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['young', 'hyper', 'no', 'no lenses']
featVec ['young', 'hyper', 'no', 'normal', 'soft']
featVec ['young', 'hyper', 'yes', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['young', 'hyper', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['young', 'hyper', 'yes', 'no lenses']
featVec ['young', 'hyper', 'yes', 'normal', 'hard']
featVec ['pre', 'myope', 'no', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['pre', 'myope', 'no']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['pre', 'myope', 'no', 'no lenses']
featVec ['pre', 'myope', 'no', 'normal', 'soft']
featVec ['pre', 'myope', 'yes', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['pre', 'myope', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['pre', 'myope', 'yes', 'no lenses']
featVec ['pre', 'myope', 'yes', 'normal', 'hard']
featVec ['pre', 'hyper', 'no', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['pre', 'hyper', 'no']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['pre', 'hyper', 'no', 'no lenses']
featVec ['pre', 'hyper', 'no', 'normal', 'soft']
featVec ['pre', 'hyper', 'yes', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['pre', 'hyper', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['pre', 'hyper', 'yes', 'no lenses']
featVec ['pre', 'hyper', 'yes', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'no']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'no', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'yes', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'normal', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'no']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'no', 'no lenses']
featVec ['presbyopic', 'hyper', 'no', 'normal', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'yes', 'no lenses']
featVec ['presbyopic', 'hyper', 'yes', 'normal', 'no lenses']
featVec ['young', 'myope', 'no', 'reduced', 'no lenses']
featVec ['young', 'myope', 'no', 'normal', 'soft']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['young', 'myope', 'no']
featVec[axis+1:] ['soft']
axis 3 reducedFeatVec: ['young', 'myope', 'no', 'soft']
featVec ['young', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['young', 'myope', 'yes', 'normal', 'hard']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['young', 'myope', 'yes']
featVec[axis+1:] ['hard']
axis 3 reducedFeatVec: ['young', 'myope', 'yes', 'hard']
featVec ['young', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'no', 'normal', 'soft']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['young', 'hyper', 'no']
featVec[axis+1:] ['soft']
axis 3 reducedFeatVec: ['young', 'hyper', 'no', 'soft']
featVec ['young', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'yes', 'normal', 'hard']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['young', 'hyper', 'yes']
featVec[axis+1:] ['hard']
axis 3 reducedFeatVec: ['young', 'hyper', 'yes', 'hard']
featVec ['pre', 'myope', 'no', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'no', 'normal', 'soft']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['pre', 'myope', 'no']
featVec[axis+1:] ['soft']
axis 3 reducedFeatVec: ['pre', 'myope', 'no', 'soft']
featVec ['pre', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'yes', 'normal', 'hard']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['pre', 'myope', 'yes']
featVec[axis+1:] ['hard']
axis 3 reducedFeatVec: ['pre', 'myope', 'yes', 'hard']
featVec ['pre', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'no', 'normal', 'soft']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['pre', 'hyper', 'no']
featVec[axis+1:] ['soft']
axis 3 reducedFeatVec: ['pre', 'hyper', 'no', 'soft']
featVec ['pre', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'yes', 'normal', 'no lenses']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['pre', 'hyper', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['pre', 'hyper', 'yes', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'normal', 'no lenses']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'no']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'no', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'normal', 'hard']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'yes']
featVec[axis+1:] ['hard']
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'yes', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'no', 'normal', 'soft']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'no']
featVec[axis+1:] ['soft']
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'no', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'yes', 'normal', 'no lenses']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'yes', 'no lenses']
baseEntropy 1.3260875253642983 i: 3 newEntropy 0.7772925846688997 infoGain 0.5487949406953986
bestFeatLabel tearRate
myTree::: {'tearRate': {}}
labels: ['age', 'prescript', 'astigmatic']
subLabels: ['age', 'prescript', 'astigmatic']
featVec ['young', 'myope', 'no', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['young', 'myope', 'no']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['young', 'myope', 'no', 'no lenses']
featVec ['young', 'myope', 'no', 'normal', 'soft']
featVec ['young', 'myope', 'yes', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['young', 'myope', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['young', 'myope', 'yes', 'no lenses']
featVec ['young', 'myope', 'yes', 'normal', 'hard']
featVec ['young', 'hyper', 'no', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['young', 'hyper', 'no']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['young', 'hyper', 'no', 'no lenses']
featVec ['young', 'hyper', 'no', 'normal', 'soft']
featVec ['young', 'hyper', 'yes', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['young', 'hyper', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['young', 'hyper', 'yes', 'no lenses']
featVec ['young', 'hyper', 'yes', 'normal', 'hard']
featVec ['pre', 'myope', 'no', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['pre', 'myope', 'no']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['pre', 'myope', 'no', 'no lenses']
featVec ['pre', 'myope', 'no', 'normal', 'soft']
featVec ['pre', 'myope', 'yes', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['pre', 'myope', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['pre', 'myope', 'yes', 'no lenses']
featVec ['pre', 'myope', 'yes', 'normal', 'hard']
featVec ['pre', 'hyper', 'no', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['pre', 'hyper', 'no']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['pre', 'hyper', 'no', 'no lenses']
featVec ['pre', 'hyper', 'no', 'normal', 'soft']
featVec ['pre', 'hyper', 'yes', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['pre', 'hyper', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['pre', 'hyper', 'yes', 'no lenses']
featVec ['pre', 'hyper', 'yes', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'no']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'no', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'normal', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'yes', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'normal', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'no']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'no', 'no lenses']
featVec ['presbyopic', 'hyper', 'no', 'normal', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'reduced', 'no lenses']
axis 3 featVec[axis] reduced
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'yes', 'no lenses']
featVec ['presbyopic', 'hyper', 'yes', 'normal', 'no lenses']
labels: ['age', 'prescript', 'astigmatic']
classList: ['no lenses', 'no lenses', 'no lenses', 'no lenses', 'no lenses', 'no lenses', 'no lenses', 'no lenses', 'no lenses', 'no lenses', 'no lenses', 'no lenses']
classList[0]: no lenses
classList.count(classList[0]): 12
subLabels: ['age', 'prescript', 'astigmatic']
featVec ['young', 'myope', 'no', 'reduced', 'no lenses']
featVec ['young', 'myope', 'no', 'normal', 'soft']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['young', 'myope', 'no']
featVec[axis+1:] ['soft']
axis 3 reducedFeatVec: ['young', 'myope', 'no', 'soft']
featVec ['young', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['young', 'myope', 'yes', 'normal', 'hard']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['young', 'myope', 'yes']
featVec[axis+1:] ['hard']
axis 3 reducedFeatVec: ['young', 'myope', 'yes', 'hard']
featVec ['young', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'no', 'normal', 'soft']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['young', 'hyper', 'no']
featVec[axis+1:] ['soft']
axis 3 reducedFeatVec: ['young', 'hyper', 'no', 'soft']
featVec ['young', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['young', 'hyper', 'yes', 'normal', 'hard']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['young', 'hyper', 'yes']
featVec[axis+1:] ['hard']
axis 3 reducedFeatVec: ['young', 'hyper', 'yes', 'hard']
featVec ['pre', 'myope', 'no', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'no', 'normal', 'soft']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['pre', 'myope', 'no']
featVec[axis+1:] ['soft']
axis 3 reducedFeatVec: ['pre', 'myope', 'no', 'soft']
featVec ['pre', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'myope', 'yes', 'normal', 'hard']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['pre', 'myope', 'yes']
featVec[axis+1:] ['hard']
axis 3 reducedFeatVec: ['pre', 'myope', 'yes', 'hard']
featVec ['pre', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'no', 'normal', 'soft']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['pre', 'hyper', 'no']
featVec[axis+1:] ['soft']
axis 3 reducedFeatVec: ['pre', 'hyper', 'no', 'soft']
featVec ['pre', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['pre', 'hyper', 'yes', 'normal', 'no lenses']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['pre', 'hyper', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['pre', 'hyper', 'yes', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'normal', 'no lenses']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'no']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'no', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'normal', 'hard']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'yes']
featVec[axis+1:] ['hard']
axis 3 reducedFeatVec: ['presbyopic', 'myope', 'yes', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'no', 'normal', 'soft']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'no']
featVec[axis+1:] ['soft']
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'no', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'reduced', 'no lenses']
featVec ['presbyopic', 'hyper', 'yes', 'normal', 'no lenses']
axis 3 featVec[axis] normal
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'yes']
featVec[axis+1:] ['no lenses']
axis 3 reducedFeatVec: ['presbyopic', 'hyper', 'yes', 'no lenses']
labels: ['age', 'prescript', 'astigmatic']
classList: ['soft', 'hard', 'soft', 'hard', 'soft', 'hard', 'soft', 'no lenses', 'no lenses', 'hard', 'soft', 'no lenses']
classList[0]: soft
classList.count(classList[0]): 5
baseEntropy: 1.5545851693377994
featList: ['young', 'young', 'young', 'young', 'pre', 'pre', 'pre', 'pre', 'presbyopic', 'presbyopic', 'presbyopic', 'presbyopic']
uniqueVals: {'young', 'pre', 'presbyopic'}
featVec ['young', 'myope', 'no', 'soft']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'no', 'soft']
axis 0 reducedFeatVec: ['myope', 'no', 'soft']
featVec ['young', 'myope', 'yes', 'hard']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'yes', 'hard']
axis 0 reducedFeatVec: ['myope', 'yes', 'hard']
featVec ['young', 'hyper', 'no', 'soft']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'no', 'soft']
axis 0 reducedFeatVec: ['hyper', 'no', 'soft']
featVec ['young', 'hyper', 'yes', 'hard']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'yes', 'hard']
axis 0 reducedFeatVec: ['hyper', 'yes', 'hard']
featVec ['pre', 'myope', 'no', 'soft']
featVec ['pre', 'myope', 'yes', 'hard']
featVec ['pre', 'hyper', 'no', 'soft']
featVec ['pre', 'hyper', 'yes', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'no lenses']
featVec ['young', 'myope', 'no', 'soft']
featVec ['young', 'myope', 'yes', 'hard']
featVec ['young', 'hyper', 'no', 'soft']
featVec ['young', 'hyper', 'yes', 'hard']
featVec ['pre', 'myope', 'no', 'soft']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'no', 'soft']
axis 0 reducedFeatVec: ['myope', 'no', 'soft']
featVec ['pre', 'myope', 'yes', 'hard']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'yes', 'hard']
axis 0 reducedFeatVec: ['myope', 'yes', 'hard']
featVec ['pre', 'hyper', 'no', 'soft']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'no', 'soft']
axis 0 reducedFeatVec: ['hyper', 'no', 'soft']
featVec ['pre', 'hyper', 'yes', 'no lenses']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'yes', 'no lenses']
axis 0 reducedFeatVec: ['hyper', 'yes', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'no lenses']
featVec ['young', 'myope', 'no', 'soft']
featVec ['young', 'myope', 'yes', 'hard']
featVec ['young', 'hyper', 'no', 'soft']
featVec ['young', 'hyper', 'yes', 'hard']
featVec ['pre', 'myope', 'no', 'soft']
featVec ['pre', 'myope', 'yes', 'hard']
featVec ['pre', 'hyper', 'no', 'soft']
featVec ['pre', 'hyper', 'yes', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'no lenses']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'no', 'no lenses']
axis 0 reducedFeatVec: ['myope', 'no', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'hard']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'yes', 'hard']
axis 0 reducedFeatVec: ['myope', 'yes', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'soft']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'no', 'soft']
axis 0 reducedFeatVec: ['hyper', 'no', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'no lenses']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'yes', 'no lenses']
axis 0 reducedFeatVec: ['hyper', 'yes', 'no lenses']
baseEntropy 1.5545851693377994 i: 0 newEntropy 1.3333333333333333 infoGain 0.22125183600446618
featList: ['myope', 'myope', 'hyper', 'hyper', 'myope', 'myope', 'hyper', 'hyper', 'myope', 'myope', 'hyper', 'hyper']
uniqueVals: {'myope', 'hyper'}
featVec ['young', 'myope', 'no', 'soft']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['no', 'soft']
axis 1 reducedFeatVec: ['young', 'no', 'soft']
featVec ['young', 'myope', 'yes', 'hard']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['yes', 'hard']
axis 1 reducedFeatVec: ['young', 'yes', 'hard']
featVec ['young', 'hyper', 'no', 'soft']
featVec ['young', 'hyper', 'yes', 'hard']
featVec ['pre', 'myope', 'no', 'soft']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['no', 'soft']
axis 1 reducedFeatVec: ['pre', 'no', 'soft']
featVec ['pre', 'myope', 'yes', 'hard']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['yes', 'hard']
axis 1 reducedFeatVec: ['pre', 'yes', 'hard']
featVec ['pre', 'hyper', 'no', 'soft']
featVec ['pre', 'hyper', 'yes', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'no lenses']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['no', 'no lenses']
axis 1 reducedFeatVec: ['presbyopic', 'no', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'hard']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['yes', 'hard']
axis 1 reducedFeatVec: ['presbyopic', 'yes', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'no lenses']
featVec ['young', 'myope', 'no', 'soft']
featVec ['young', 'myope', 'yes', 'hard']
featVec ['young', 'hyper', 'no', 'soft']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['no', 'soft']
axis 1 reducedFeatVec: ['young', 'no', 'soft']
featVec ['young', 'hyper', 'yes', 'hard']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['yes', 'hard']
axis 1 reducedFeatVec: ['young', 'yes', 'hard']
featVec ['pre', 'myope', 'no', 'soft']
featVec ['pre', 'myope', 'yes', 'hard']
featVec ['pre', 'hyper', 'no', 'soft']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['no', 'soft']
axis 1 reducedFeatVec: ['pre', 'no', 'soft']
featVec ['pre', 'hyper', 'yes', 'no lenses']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['yes', 'no lenses']
axis 1 reducedFeatVec: ['pre', 'yes', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'soft']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['no', 'soft']
axis 1 reducedFeatVec: ['presbyopic', 'no', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'no lenses']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['yes', 'no lenses']
axis 1 reducedFeatVec: ['presbyopic', 'yes', 'no lenses']
baseEntropy 1.5545851693377994 i: 1 newEntropy 1.4591479170272446 infoGain 0.09543725231055489
featList: ['no', 'yes', 'no', 'yes', 'no', 'yes', 'no', 'yes', 'no', 'yes', 'no', 'yes']
uniqueVals: {'yes', 'no'}
featVec ['young', 'myope', 'no', 'soft']
featVec ['young', 'myope', 'yes', 'hard']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['young', 'myope']
featVec[axis+1:] ['hard']
axis 2 reducedFeatVec: ['young', 'myope', 'hard']
featVec ['young', 'hyper', 'no', 'soft']
featVec ['young', 'hyper', 'yes', 'hard']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['young', 'hyper']
featVec[axis+1:] ['hard']
axis 2 reducedFeatVec: ['young', 'hyper', 'hard']
featVec ['pre', 'myope', 'no', 'soft']
featVec ['pre', 'myope', 'yes', 'hard']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['pre', 'myope']
featVec[axis+1:] ['hard']
axis 2 reducedFeatVec: ['pre', 'myope', 'hard']
featVec ['pre', 'hyper', 'no', 'soft']
featVec ['pre', 'hyper', 'yes', 'no lenses']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['pre', 'hyper']
featVec[axis+1:] ['no lenses']
axis 2 reducedFeatVec: ['pre', 'hyper', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'hard']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['presbyopic', 'myope']
featVec[axis+1:] ['hard']
axis 2 reducedFeatVec: ['presbyopic', 'myope', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'no lenses']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['presbyopic', 'hyper']
featVec[axis+1:] ['no lenses']
axis 2 reducedFeatVec: ['presbyopic', 'hyper', 'no lenses']
featVec ['young', 'myope', 'no', 'soft']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['young', 'myope']
featVec[axis+1:] ['soft']
axis 2 reducedFeatVec: ['young', 'myope', 'soft']
featVec ['young', 'myope', 'yes', 'hard']
featVec ['young', 'hyper', 'no', 'soft']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['young', 'hyper']
featVec[axis+1:] ['soft']
axis 2 reducedFeatVec: ['young', 'hyper', 'soft']
featVec ['young', 'hyper', 'yes', 'hard']
featVec ['pre', 'myope', 'no', 'soft']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['pre', 'myope']
featVec[axis+1:] ['soft']
axis 2 reducedFeatVec: ['pre', 'myope', 'soft']
featVec ['pre', 'myope', 'yes', 'hard']
featVec ['pre', 'hyper', 'no', 'soft']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['pre', 'hyper']
featVec[axis+1:] ['soft']
axis 2 reducedFeatVec: ['pre', 'hyper', 'soft']
featVec ['pre', 'hyper', 'yes', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'no lenses']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['presbyopic', 'myope']
featVec[axis+1:] ['no lenses']
axis 2 reducedFeatVec: ['presbyopic', 'myope', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'soft']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['presbyopic', 'hyper']
featVec[axis+1:] ['soft']
axis 2 reducedFeatVec: ['presbyopic', 'hyper', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'no lenses']
baseEntropy 1.5545851693377994 i: 2 newEntropy 0.7841591278514218 infoGain 0.7704260414863776
bestFeatLabel astigmatic
myTree::: {'astigmatic': {}}
labels: ['age', 'prescript']
subLabels: ['age', 'prescript']
featVec ['young', 'myope', 'no', 'soft']
featVec ['young', 'myope', 'yes', 'hard']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['young', 'myope']
featVec[axis+1:] ['hard']
axis 2 reducedFeatVec: ['young', 'myope', 'hard']
featVec ['young', 'hyper', 'no', 'soft']
featVec ['young', 'hyper', 'yes', 'hard']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['young', 'hyper']
featVec[axis+1:] ['hard']
axis 2 reducedFeatVec: ['young', 'hyper', 'hard']
featVec ['pre', 'myope', 'no', 'soft']
featVec ['pre', 'myope', 'yes', 'hard']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['pre', 'myope']
featVec[axis+1:] ['hard']
axis 2 reducedFeatVec: ['pre', 'myope', 'hard']
featVec ['pre', 'hyper', 'no', 'soft']
featVec ['pre', 'hyper', 'yes', 'no lenses']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['pre', 'hyper']
featVec[axis+1:] ['no lenses']
axis 2 reducedFeatVec: ['pre', 'hyper', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'hard']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['presbyopic', 'myope']
featVec[axis+1:] ['hard']
axis 2 reducedFeatVec: ['presbyopic', 'myope', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'no lenses']
axis 2 featVec[axis] yes
axis 2 reducedFeatVec: ['presbyopic', 'hyper']
featVec[axis+1:] ['no lenses']
axis 2 reducedFeatVec: ['presbyopic', 'hyper', 'no lenses']
labels: ['age', 'prescript']
classList: ['hard', 'hard', 'hard', 'no lenses', 'hard', 'no lenses']
classList[0]: hard
classList.count(classList[0]): 4
baseEntropy: 0.9182958340544896
featList: ['young', 'young', 'pre', 'pre', 'presbyopic', 'presbyopic']
uniqueVals: {'young', 'pre', 'presbyopic'}
featVec ['young', 'myope', 'hard']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'hard']
axis 0 reducedFeatVec: ['myope', 'hard']
featVec ['young', 'hyper', 'hard']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'hard']
axis 0 reducedFeatVec: ['hyper', 'hard']
featVec ['pre', 'myope', 'hard']
featVec ['pre', 'hyper', 'no lenses']
featVec ['presbyopic', 'myope', 'hard']
featVec ['presbyopic', 'hyper', 'no lenses']
featVec ['young', 'myope', 'hard']
featVec ['young', 'hyper', 'hard']
featVec ['pre', 'myope', 'hard']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'hard']
axis 0 reducedFeatVec: ['myope', 'hard']
featVec ['pre', 'hyper', 'no lenses']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'no lenses']
axis 0 reducedFeatVec: ['hyper', 'no lenses']
featVec ['presbyopic', 'myope', 'hard']
featVec ['presbyopic', 'hyper', 'no lenses']
featVec ['young', 'myope', 'hard']
featVec ['young', 'hyper', 'hard']
featVec ['pre', 'myope', 'hard']
featVec ['pre', 'hyper', 'no lenses']
featVec ['presbyopic', 'myope', 'hard']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'hard']
axis 0 reducedFeatVec: ['myope', 'hard']
featVec ['presbyopic', 'hyper', 'no lenses']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'no lenses']
axis 0 reducedFeatVec: ['hyper', 'no lenses']
baseEntropy 0.9182958340544896 i: 0 newEntropy 0.6666666666666666 infoGain 0.2516291673878229
featList: ['myope', 'hyper', 'myope', 'hyper', 'myope', 'hyper']
uniqueVals: {'myope', 'hyper'}
featVec ['young', 'myope', 'hard']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['hard']
axis 1 reducedFeatVec: ['young', 'hard']
featVec ['young', 'hyper', 'hard']
featVec ['pre', 'myope', 'hard']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['hard']
axis 1 reducedFeatVec: ['pre', 'hard']
featVec ['pre', 'hyper', 'no lenses']
featVec ['presbyopic', 'myope', 'hard']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['hard']
axis 1 reducedFeatVec: ['presbyopic', 'hard']
featVec ['presbyopic', 'hyper', 'no lenses']
featVec ['young', 'myope', 'hard']
featVec ['young', 'hyper', 'hard']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['hard']
axis 1 reducedFeatVec: ['young', 'hard']
featVec ['pre', 'myope', 'hard']
featVec ['pre', 'hyper', 'no lenses']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['no lenses']
axis 1 reducedFeatVec: ['pre', 'no lenses']
featVec ['presbyopic', 'myope', 'hard']
featVec ['presbyopic', 'hyper', 'no lenses']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['no lenses']
axis 1 reducedFeatVec: ['presbyopic', 'no lenses']
baseEntropy 0.9182958340544896 i: 1 newEntropy 0.4591479170272448 infoGain 0.4591479170272448
bestFeatLabel prescript
myTree::: {'prescript': {}}
labels: ['age']
subLabels: ['age']
featVec ['young', 'myope', 'hard']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['hard']
axis 1 reducedFeatVec: ['young', 'hard']
featVec ['young', 'hyper', 'hard']
featVec ['pre', 'myope', 'hard']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['hard']
axis 1 reducedFeatVec: ['pre', 'hard']
featVec ['pre', 'hyper', 'no lenses']
featVec ['presbyopic', 'myope', 'hard']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['hard']
axis 1 reducedFeatVec: ['presbyopic', 'hard']
featVec ['presbyopic', 'hyper', 'no lenses']
labels: ['age']
classList: ['hard', 'hard', 'hard']
classList[0]: hard
classList.count(classList[0]): 3
subLabels: ['age']
featVec ['young', 'myope', 'hard']
featVec ['young', 'hyper', 'hard']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['hard']
axis 1 reducedFeatVec: ['young', 'hard']
featVec ['pre', 'myope', 'hard']
featVec ['pre', 'hyper', 'no lenses']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['no lenses']
axis 1 reducedFeatVec: ['pre', 'no lenses']
featVec ['presbyopic', 'myope', 'hard']
featVec ['presbyopic', 'hyper', 'no lenses']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['no lenses']
axis 1 reducedFeatVec: ['presbyopic', 'no lenses']
labels: ['age']
classList: ['hard', 'no lenses', 'no lenses']
classList[0]: hard
classList.count(classList[0]): 1
baseEntropy: 0.9182958340544896
featList: ['young', 'pre', 'presbyopic']
uniqueVals: {'young', 'pre', 'presbyopic'}
featVec ['young', 'hard']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hard']
axis 0 reducedFeatVec: ['hard']
featVec ['pre', 'no lenses']
featVec ['presbyopic', 'no lenses']
featVec ['young', 'hard']
featVec ['pre', 'no lenses']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['no lenses']
axis 0 reducedFeatVec: ['no lenses']
featVec ['presbyopic', 'no lenses']
featVec ['young', 'hard']
featVec ['pre', 'no lenses']
featVec ['presbyopic', 'no lenses']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['no lenses']
axis 0 reducedFeatVec: ['no lenses']
baseEntropy 0.9182958340544896 i: 0 newEntropy 0.0 infoGain 0.9182958340544896
bestFeatLabel age
myTree::: {'age': {}}
labels: []
subLabels: []
featVec ['young', 'hard']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hard']
axis 0 reducedFeatVec: ['hard']
featVec ['pre', 'no lenses']
featVec ['presbyopic', 'no lenses']
labels: []
classList: ['hard']
classList[0]: hard
classList.count(classList[0]): 1
subLabels: []
featVec ['young', 'hard']
featVec ['pre', 'no lenses']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['no lenses']
axis 0 reducedFeatVec: ['no lenses']
featVec ['presbyopic', 'no lenses']
labels: []
classList: ['no lenses']
classList[0]: no lenses
classList.count(classList[0]): 1
subLabels: []
featVec ['young', 'hard']
featVec ['pre', 'no lenses']
featVec ['presbyopic', 'no lenses']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['no lenses']
axis 0 reducedFeatVec: ['no lenses']
labels: []
classList: ['no lenses']
classList[0]: no lenses
classList.count(classList[0]): 1
subLabels: ['age', 'prescript']
featVec ['young', 'myope', 'no', 'soft']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['young', 'myope']
featVec[axis+1:] ['soft']
axis 2 reducedFeatVec: ['young', 'myope', 'soft']
featVec ['young', 'myope', 'yes', 'hard']
featVec ['young', 'hyper', 'no', 'soft']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['young', 'hyper']
featVec[axis+1:] ['soft']
axis 2 reducedFeatVec: ['young', 'hyper', 'soft']
featVec ['young', 'hyper', 'yes', 'hard']
featVec ['pre', 'myope', 'no', 'soft']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['pre', 'myope']
featVec[axis+1:] ['soft']
axis 2 reducedFeatVec: ['pre', 'myope', 'soft']
featVec ['pre', 'myope', 'yes', 'hard']
featVec ['pre', 'hyper', 'no', 'soft']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['pre', 'hyper']
featVec[axis+1:] ['soft']
axis 2 reducedFeatVec: ['pre', 'hyper', 'soft']
featVec ['pre', 'hyper', 'yes', 'no lenses']
featVec ['presbyopic', 'myope', 'no', 'no lenses']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['presbyopic', 'myope']
featVec[axis+1:] ['no lenses']
axis 2 reducedFeatVec: ['presbyopic', 'myope', 'no lenses']
featVec ['presbyopic', 'myope', 'yes', 'hard']
featVec ['presbyopic', 'hyper', 'no', 'soft']
axis 2 featVec[axis] no
axis 2 reducedFeatVec: ['presbyopic', 'hyper']
featVec[axis+1:] ['soft']
axis 2 reducedFeatVec: ['presbyopic', 'hyper', 'soft']
featVec ['presbyopic', 'hyper', 'yes', 'no lenses']
labels: ['age', 'prescript']
classList: ['soft', 'soft', 'soft', 'soft', 'no lenses', 'soft']
classList[0]: soft
classList.count(classList[0]): 5
baseEntropy: 0.6500224216483541
featList: ['young', 'young', 'pre', 'pre', 'presbyopic', 'presbyopic']
uniqueVals: {'young', 'pre', 'presbyopic'}
featVec ['young', 'myope', 'soft']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'soft']
axis 0 reducedFeatVec: ['myope', 'soft']
featVec ['young', 'hyper', 'soft']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'soft']
axis 0 reducedFeatVec: ['hyper', 'soft']
featVec ['pre', 'myope', 'soft']
featVec ['pre', 'hyper', 'soft']
featVec ['presbyopic', 'myope', 'no lenses']
featVec ['presbyopic', 'hyper', 'soft']
featVec ['young', 'myope', 'soft']
featVec ['young', 'hyper', 'soft']
featVec ['pre', 'myope', 'soft']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'soft']
axis 0 reducedFeatVec: ['myope', 'soft']
featVec ['pre', 'hyper', 'soft']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'soft']
axis 0 reducedFeatVec: ['hyper', 'soft']
featVec ['presbyopic', 'myope', 'no lenses']
featVec ['presbyopic', 'hyper', 'soft']
featVec ['young', 'myope', 'soft']
featVec ['young', 'hyper', 'soft']
featVec ['pre', 'myope', 'soft']
featVec ['pre', 'hyper', 'soft']
featVec ['presbyopic', 'myope', 'no lenses']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'no lenses']
axis 0 reducedFeatVec: ['myope', 'no lenses']
featVec ['presbyopic', 'hyper', 'soft']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'soft']
axis 0 reducedFeatVec: ['hyper', 'soft']
baseEntropy 0.6500224216483541 i: 0 newEntropy 0.3333333333333333 infoGain 0.3166890883150208
featList: ['myope', 'hyper', 'myope', 'hyper', 'myope', 'hyper']
uniqueVals: {'myope', 'hyper'}
featVec ['young', 'myope', 'soft']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['soft']
axis 1 reducedFeatVec: ['young', 'soft']
featVec ['young', 'hyper', 'soft']
featVec ['pre', 'myope', 'soft']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['soft']
axis 1 reducedFeatVec: ['pre', 'soft']
featVec ['pre', 'hyper', 'soft']
featVec ['presbyopic', 'myope', 'no lenses']
axis 1 featVec[axis] myope
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['no lenses']
axis 1 reducedFeatVec: ['presbyopic', 'no lenses']
featVec ['presbyopic', 'hyper', 'soft']
featVec ['young', 'myope', 'soft']
featVec ['young', 'hyper', 'soft']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['young']
featVec[axis+1:] ['soft']
axis 1 reducedFeatVec: ['young', 'soft']
featVec ['pre', 'myope', 'soft']
featVec ['pre', 'hyper', 'soft']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['pre']
featVec[axis+1:] ['soft']
axis 1 reducedFeatVec: ['pre', 'soft']
featVec ['presbyopic', 'myope', 'no lenses']
featVec ['presbyopic', 'hyper', 'soft']
axis 1 featVec[axis] hyper
axis 1 reducedFeatVec: ['presbyopic']
featVec[axis+1:] ['soft']
axis 1 reducedFeatVec: ['presbyopic', 'soft']
baseEntropy 0.6500224216483541 i: 1 newEntropy 0.4591479170272448 infoGain 0.19087450462110933
bestFeatLabel age
myTree::: {'age': {}}
labels: ['prescript']
subLabels: ['prescript']
featVec ['young', 'myope', 'soft']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'soft']
axis 0 reducedFeatVec: ['myope', 'soft']
featVec ['young', 'hyper', 'soft']
axis 0 featVec[axis] young
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'soft']
axis 0 reducedFeatVec: ['hyper', 'soft']
featVec ['pre', 'myope', 'soft']
featVec ['pre', 'hyper', 'soft']
featVec ['presbyopic', 'myope', 'no lenses']
featVec ['presbyopic', 'hyper', 'soft']
labels: ['prescript']
classList: ['soft', 'soft']
classList[0]: soft
classList.count(classList[0]): 2
subLabels: ['prescript']
featVec ['young', 'myope', 'soft']
featVec ['young', 'hyper', 'soft']
featVec ['pre', 'myope', 'soft']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'soft']
axis 0 reducedFeatVec: ['myope', 'soft']
featVec ['pre', 'hyper', 'soft']
axis 0 featVec[axis] pre
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'soft']
axis 0 reducedFeatVec: ['hyper', 'soft']
featVec ['presbyopic', 'myope', 'no lenses']
featVec ['presbyopic', 'hyper', 'soft']
labels: ['prescript']
classList: ['soft', 'soft']
classList[0]: soft
classList.count(classList[0]): 2
subLabels: ['prescript']
featVec ['young', 'myope', 'soft']
featVec ['young', 'hyper', 'soft']
featVec ['pre', 'myope', 'soft']
featVec ['pre', 'hyper', 'soft']
featVec ['presbyopic', 'myope', 'no lenses']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['myope', 'no lenses']
axis 0 reducedFeatVec: ['myope', 'no lenses']
featVec ['presbyopic', 'hyper', 'soft']
axis 0 featVec[axis] presbyopic
axis 0 reducedFeatVec: []
featVec[axis+1:] ['hyper', 'soft']
axis 0 reducedFeatVec: ['hyper', 'soft']
labels: ['prescript']
classList: ['no lenses', 'soft']
classList[0]: no lenses
classList.count(classList[0]): 1
baseEntropy: 1.0
featList: ['myope', 'hyper']
uniqueVals: {'myope', 'hyper'}
featVec ['myope', 'no lenses']
axis 0 featVec[axis] myope
axis 0 reducedFeatVec: []
featVec[axis+1:] ['no lenses']
axis 0 reducedFeatVec: ['no lenses']
featVec ['hyper', 'soft']
featVec ['myope', 'no lenses']
featVec ['hyper', 'soft']
axis 0 featVec[axis] hyper
axis 0 reducedFeatVec: []
featVec[axis+1:] ['soft']
axis 0 reducedFeatVec: ['soft']
baseEntropy 1.0 i: 0 newEntropy 0.0 infoGain 1.0
bestFeatLabel prescript
myTree::: {'prescript': {}}
labels: []
subLabels: []
featVec ['myope', 'no lenses']
axis 0 featVec[axis] myope
axis 0 reducedFeatVec: []
featVec[axis+1:] ['no lenses']
axis 0 reducedFeatVec: ['no lenses']
featVec ['hyper', 'soft']
labels: []
classList: ['no lenses']
classList[0]: no lenses
classList.count(classList[0]): 1
subLabels: []
featVec ['myope', 'no lenses']
featVec ['hyper', 'soft']
axis 0 featVec[axis] hyper
axis 0 reducedFeatVec: []
featVec[axis+1:] ['soft']
axis 0 reducedFeatVec: ['soft']
labels: []
classList: ['soft']
classList[0]: soft
classList.count(classList[0]): 1
createPlot(lensesTree)

png



Artificial Intelligence   Machine Learning   Algorithm      Machine Learning Algorithm 决策树

本博客所有文章除特别声明外,均采用 CC BY-SA 3.0协议 。转载请注明出处!