赞
踩
用决策树方法对买电脑进行分类预测
- from sklearn.feature_extraction import DictVectorizer
- import csv
- from sklearn import preprocessing
- from sklearn import tree
- # from sklearn.externals.six import StringIO
-
- allElectronicsDate = open(r'E:\Python\practice\Decision_Tree\Class_buys_computer.csv','rt')
- reader = csv.reader(allElectronicsDate)#CSV模块自带的reader方法,可按行读取内容
- # print('reader:'+ str(reader))
- headers = next(reader)
-
- print(headers)
-
-
- featureList = []
- labelList = []
-
- for row in reade
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。