赞
踩
决策树有ID3 C4.5 CART比较经典的算法,不过现在用的比较少,一般用随机森林多。
这里简单学习一下ID3,它是基于信息熵的
#-*- coding: utf-8 -*-
#使用ID3决策树算法预测销量高低
import pandas as pd
import numpy as np
from sklearn.cross_validation import train_test_split
from sklearn.metrics import classification_report
#参数初始化
inputfile = 'F:/PythonMaterial/chapter5/chapter5/demo/data/sales_data.xls'
data = pd.read_excel(inputfile, index_col = u'序号') #导入数据,当指定index_col时,这一列就不作为
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。