MCPcopy Create free account
hub / github.com/Jack-Cherish/Machine-Learning / createDataSet

Function createDataSet

Decision Tree/Decision Tree.py:51–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49 2017-07-20
50"""
51def createDataSet():
52 dataSet = [[0, 0, 0, 0, 'no'], #数据集
53 [0, 0, 0, 1, 'no'],
54 [0, 1, 0, 1, 'yes'],
55 [0, 1, 1, 0, 'yes'],
56 [0, 0, 0, 0, 'no'],
57 [1, 0, 0, 0, 'no'],
58 [1, 0, 0, 1, 'no'],
59 [1, 1, 1, 1, 'yes'],
60 [1, 0, 1, 2, 'yes'],
61 [1, 0, 1, 2, 'yes'],
62 [2, 0, 1, 2, 'yes'],
63 [2, 0, 1, 1, 'yes'],
64 [2, 1, 0, 1, 'yes'],
65 [2, 1, 0, 2, 'yes'],
66 [2, 0, 0, 0, 'no']]
67 labels = ['年龄', '有工作', '有自己的房子', '信贷情况'] #特征标签
68 return dataSet, labels #返回数据集和分类属性
69
70"""
71函数说明:按照给定特征划分数据集

Callers 1

Decision Tree.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected