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

网站 备案 换空间番禺招聘网官网

网站 备案 换空间,番禺招聘网官网,微网站如何做宣传,怎么看别人网站是哪里做的1. 随机森林超参数 极其重要的三个超参数是必须要调整的#xff0c;一般再加上两到三个其他超参数进行优化即可。 2. 学习曲线确定n_estimators搜索范围 首先导入必要的库#xff0c;使用sklearn自带的房价预测数据集#xff1a; import numpy as np import pandas as pd f…1. 随机森林超参数 极其重要的三个超参数是必须要调整的一般再加上两到三个其他超参数进行优化即可。 2. 学习曲线确定n_estimators搜索范围 首先导入必要的库使用sklearn自带的房价预测数据集 import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.datasets import fetch_california_housing from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import KFold from sklearn.model_selection import cross_validate import matplotlib.pyplot as plt housing fetch_california_housing() # 特征数据 X housing.data[:, [0, 1, 2, 3, 4, 5, 6, 7]] # 目标变量房价 y housing.target 初始化以及5折交叉验证计算RMSE trainRMSE np.array([]) testRMSE np.array([]) trainSTD np.array([]) testSTD np.array([])Option range(5,101,5) for n_estimators in Option :reg_f RandomForestRegressor(n_estimatorsn_estimators, random_state1412)# 交叉验证输出结果cv KFold(n_splits5,shuffleTrue,random_state1412)result_f cross_validate(reg_f,X,y,cvcv,scoringneg_mean_squared_error,return_train_scoreTrue,n_jobs-1)# 根据输出的MSE进行RMSE计算train abs(result_f[train_score])**0.5test abs(result_f[test_score])**0.5trainRMSE np.append(trainRMSE,train.mean())testRMSE np.append(testRMSE,test.mean())trainSTD np.append(trainSTD,train.std())testSTD np.append(testSTD,test.std()) 定义绘图函数  def plotCVresult(Option,trainRMSE,testRMSE,trainSTD,testSTD) :xaxis Option# RMSEplt.plot(xaxis, trainRMSE,colork,labelRandomForestTrain)plt.plot(xaxis, testRMSE, colorred, labelRandomForestTest)# 将标准差围绕在RMSE旁边区间越大表示模型越不稳定plt.plot(xaxis, trainRMSE trainSTD, colork, linestyledotted)plt.plot(xaxis, trainRMSE - trainSTD, colork, linestyledotted)plt.plot(xaxis, testRMSE testSTD, colorred, linestyledotted)plt.plot(xaxis, testRMSE - testSTD, colorred, linestyledotted)plt.xticks([*xaxis])plt.legend(loc1)plt.xlabel(n_estimators)plt.ylabel(RMSE)plt.title(Learning Curve)plt.show()plotCVresult(Option,trainRMSE,testRMSE,trainSTD,testSTD) 输出结果如下  3. 使用Tree模块判断max_depth搜索范围 只需在输出的最小值和最大值之间进行搜索即可。 reg_f RandomForestRegressor(n_estimators100,random_state1412) reg_f reg_f.fit(X,y) d pd.Series([],dtypeint64) for idx,t in enumerate(reg_f.estimators_) :d[idx] t.tree_.max_depth print(决策树的最大深度的最小值为,d.min()) print(决策树的最大深度的最大值为,d.max()) 输出结果为 4. 使用Tree模块判断min_weight_fraction_leaf搜索范围 reg_f RandomForestRegressor(n_estimators100,random_state1412) reg_f reg_f.fit(X,y) n pd.Series([],dtypeint64) for idx,t in enumerate(reg_f.estimators_) :n[idx] t.tree_.weighted_n_node_samples meann np.zeros(20) for i in range(0,20) :meann[i] n[i].mean() print(决策树分枝所需最小样本权重的最小值为,meann.min()) print(决策树分枝所需最小样本权重的最大值为,meann.max()) print(决策树分枝所需最小样本权重的平均值为,meann.mean()) 输出结果为 5. 使用Tree模块判断min_sample_split搜索范围 reg_f RandomForestRegressor(n_estimators20,random_state1412) reg_f reg_f.fit(X,y) s pd.Series([],dtypeint64) for idx,t in enumerate(reg_f.estimators_) :s[idx] t.tree_.n_node_samples meann np.zeros(20) for i in range(0,20) :meann[i] s[i].mean() print(决策树需要最小样本的最小值为,meann.min()) print(决策树需要最小样本的最大值为,meann.max()) print(决策树需要最小样本的平均值为,meann.mean()) 输出结果为
http://www.w-s-a.com/news/118731/

相关文章:

  • 排名好的手机网站建设番禺网站建设专家
  • 番禺怎么读百度有专做优化的没
  • 网站开发中应注意哪些问题网络营销的主要特点
  • 网站定制案例北京网站制作招聘网
  • 网站建设与推广实训小结网站建设专业英文
  • 郑州网站建设动态凡科网站建设是免费的吗
  • 湖北手机网站建设wordpress转emlog博客
  • 北京东站设计网名的花样符号
  • 安徽建设厅网站首页网站开发aichengkeji
  • 自贡网站制作荣茂网站建设
  • 什么做的网站吗正规的机械外包加工订单网
  • 网络工程公司的业务邵阳seo快速排名
  • 博主怎么赚钱网站seo找准隐迅推
  • 营销号经典废话北京网站建设公司网站优化资讯
  • 一六八互联网站建设怎么做套版网站
  • wordpress 书站建筑公司简介范文大全
  • 建设官方网站多少鲜花网站建设的主要工作流程
  • 卖主机网站轻量wordpress主题
  • 网站建设规划书结构制作一个自己的网站
  • 外贸网站商城建设做网站和推广
  • 网站建设微信群免费简约ppt模板
  • 哈尔滨网站设计公司哪家更好shopify和wordpress
  • 岚县网站建设网站建设中效果
  • 网站建设软文推广网站建设分金手指排名十四
  • 网站建设要什么知识广州注册公司地址怎么解决
  • 自己可以做开奖网站吗wordpress和hexo
  • 成都网站关键词优化wordpress价格
  • 网站开发后端站建设 app开发网站
  • 毕业设计做网站好的想法开发网站代码量
  • 西宁网站建设排名wordpress的站点地址如何配置