当前位置: 首页 > news >正文

门户网站开发如何提高产品排名天津做优化好的公司

门户网站开发如何提高产品排名,天津做优化好的公司,农村自建房100张图片,网站开发和网站运营的区别用于回归的决策树与用于分类的决策树类似,在DecisionTreeRegressor中实现。DecisionTreeRegressor不能外推,也不能在训练数据范围之外的数据进行预测。 利用计算机内存历史及格的数据进行实验,数据展示: import pandas as pd im…

用于回归的决策树与用于分类的决策树类似,在DecisionTreeRegressor中实现。DecisionTreeRegressor不能外推,也不能在训练数据范围之外的数据进行预测。

利用计算机内存历史及格的数据进行实验,数据展示:

import pandas as pd
import matplotlib.pyplot as pltplt.rcParams['font.sans-serif'] = ['SimHei']ram_price=pd.read_csv('ram_price.csv')
plt.semilogy(ram_price.date,ram_price.price)
plt.xlabel('年份')
plt.ylabel('价格')
plt.show()

利用2000年前的历史数据来预测2000年之后的价格,只用日期作为特征,对比决策树、线性模型的预测结果:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.tree import DecisionTreeRegressor
from sklearn.linear_model import LinearRegressionplt.rcParams['font.sans-serif'] = ['SimHei']
ram_price=pd.read_csv('ram_price.csv')
#plt.semilogy(ram_price.data,ram_price.price)
data_train=ram_price[ram_price.date<2000]
data_test=ram_price[ram_price.date>=2000]X_train=np.array(data_train)
#X_train=data_train.date[:, np.newaxis]
y_train=np.log(data_train.price)tree=DecisionTreeRegressor().fit(X_train,y_train)
line_reg=LinearRegression().fit(X_train,y_train)X_all = np.array(ram_price)
#X_all=ram_price.date[:,np.newaxis]
pred_tree=tree.predict(X_all)
pred_lr=line_reg.predict(X_all)price_tree=np.exp(pred_tree)
price_lr=np.exp(pred_lr)plt.semilogy(data_train.date,data_train.price,label='训练数据')
plt.semilogy(data_test.date,data_test.price,label='测试数据')
plt.semilogy(ram_price.date,price_tree,label='决策树预测')
plt.semilogy(ram_price.date,price_lr,label='线性预测')
plt.legend()
plt.show()

可以看到两个模型的差异非常明显。线性模型用一条直线对数据做近似,对2000年后的价格预测结果非常好,但忽略了训练数据和测试数据中一些更细微的变化。树模型则完美预测了训练数据,但一旦输入超过了模型训练数据的范围,模型就只能持续预测最后一个已知数据点。树不能在训练数据的范围之外生成新的响应,所有基于树的模型都有这个缺点。

http://www.laogonggong.com/news/39995.html

相关文章:

  • h5网站动画怎么做谷歌网页版入口在线
  • 自己做的网站如何包装百度识图找原图
  • 做口腔科网站项目推广方式有哪些
  • 橙子建站 推广互联网优化是什么意思
  • 服装设计网站免费电商运营怎么自学
  • 建设部网站村镇建设网站建设推广公司
  • 腾冲做兼职的网站全网热搜榜
  • 网站域名解绑今日头条最新
  • 服务器站点的网站地图怎么做网页制作官方网站
  • 宁波免费建站外包公司天津seo外包团队
  • 免费的建筑设计网站搜索引擎优化中的步骤包括
  • 温州网站建设专业的公司技能培训
  • 网站系统说明书台州网站建设方案推广
  • 什么摄像头做直播网站百度知道推广软件
  • 金华竞价排名 金华企业网站建设巨量广告投放平台
  • 宁波网站建设哪家快友情链接联盟
  • 绥化网站建设如何做企业产品推广
  • 男学网站开发郑州网站建设外包
  • 国资委两学一做网站云南seo网站关键词优化软件
  • wordpress只能下载一个文件湖北seo诊断
  • 安徽省住房和城乡建设厅网站域名seo工具查询
  • 网站地图后缀网站搜索排名优化价格
  • discuz培训网站模板下载北京百度推广公司
  • 夏县做网站精品成品网站入口
  • wordpress网站绑定多个域名杭州优化外包
  • 做电影下载网站成本如何做外贸网站的推广
  • 福州做网站fjfzwl谷歌外贸网站推广
  • 广州网站优化排名推广p站关键词排名
  • rss 网站插件seo入门黑帽培训教程
  • 电商网站开发报价单百度广告平台电话