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

如何提高网站点击率怎么做在wordpress上背景怎么调

如何提高网站点击率怎么做,在wordpress上背景怎么调,win7如何安装iis来浏览asp网站,网站的页面动态需要哪些方法做交叉验证 交叉验证#xff1a;将拿到的训练数据#xff0c;分为训练和验证集。以下图为例#xff1a;将数据分成4份#xff0c;其中 一份作为验证集。然后经过4次#xff08;组#xff09;的测试#xff0c;每次都更换不同的验证集。即得到4组模型的 结果#xff0c;取…交叉验证 交叉验证将拿到的训练数据分为训练和验证集。以下图为例将数据分成4份其中 一份作为验证集。然后经过4次组的测试每次都更换不同的验证集。即得到4组模型的 结果取平均值作为最终结果。又称4折交叉验证。 1分析 我们之前知道数据分为训练集和测试集但是为了让从训练得到模型结果更加准确。做以下处理 训练集训练集验证集测试集测试集 2为什么需要交叉验证 交叉验证目的为了让被评估的模型更加准确可信 问题那么这个只是对于参数得出更好的结果那么怎么选择或者调优参数呢? 超参数搜索-网格搜索(Grid Search) 通常情况下有很多参数是需要手动指定的如k-近邻算法中的K值这种叫超参数。 但是手动过程繁杂所以需要对模型预设几种超参数组合。每组超参数都采用交叉验证来进行评估。最后选出最优参数组合建立模型。 1模型选择与调优API sklearn.model_selection.GridSearchCV(estimator,param_gridNone,cvNone) 估计器的指定参数值进行详尽搜索estimator估计器对象param_grid估计器参数(dict){“n_neighbors:[1,3,5]}cv指定几折交叉验证fit()输入训练数据score()准确率结果分析 最佳参数best_params_最佳结果best_score_最佳估计器best_estimator_交叉验证结果cv_results_ 鸢尾花案例增加K值调优 使用GridSearchCV构建估计器 from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.neighbors import KNeighborsClassifier from sklearn.model_selection import GridSearchCVdef knn_iris_gscv()://1)获取数据irisload_iris()//2)划分数据集x_train, x_test, y_train, y_testtrain_test_split(iris.data, iris.target, random_state22)//3)特征工程:标准化transferStandardScaler()x traintransfer.fit_transform(x_train)x_testtransfer.transform(x_test)//4)KNN算法预估器estimatorKNeighborsClassifier()//加入网格搜索与交叉验证param_dict {n_neighbors:[1,3,5,7,9,11]}estimatorGridSearchCV(estimator,param_gridparam_dict,cv10)estimator.fit(x_train,y_train)//5)模型评估//方法1:直接比对真实值和预测值y_predictestimator.predict(x_test)print(y_predict:\n,y_predict)print(直接比对真实值和预测值:\n,y_testy_predict)//方法2:计算准确率scoreestimator.score(x_test,y_test)print(准确率为:\n,score)//最佳参数:best_params_print(最佳参数:\n,estimator.best_params_)//最佳结果:best_score_print(最佳结果:\n,estimator.best_score_)//最佳估计器:best_estimatir_print(最佳估计器:\n,estimator,best_estimator_)//交叉验证结果:cv_results_print(交叉验证结果:\n,estimator.cv_results_)return None案例:预测facebook签到位置 1数据集介绍 File descriptions 数据介绍将根据用户的位置准确性和时间戳预测用户正在查看的业务 官网https://www.kagge.com/navoshta/grid-knn/data 2实践 import pandas as pd// 1、获取数据 datapd.read_csv(./rBlocation/train.csv)//基本的数据处理 //1)缩小数据范围 datadata.query(x2.5 x1.5 y1.0 y1.5)//2)处理时间特征 time_valuepd.to_datetime(data[time],units) datepd.DatetimeIndex(time_value) //添加需要的项 data[day]date.day data[weekday]date.weekday data[hour]date.hour//3)过滤签到次数少的地点 place_countdata.groupby(place_id).count()[row_id] data[place_id].isin(place_count[place_count 3].index.values) data_finaldata[data[place_id].isin(place_count[place_count 3].index.values)]//筛选特征值和目标值 xdata_final[[x,y,accuracy,day,weekday,hour]] ydata_final[place_id]//数据集划分 from sklearn.model_selection import train_test_split x_train,x_test,y_train,y_testtrain_test_split(x,y)from sklearn.preprocessing import StandardScaler from sklearn.neighbors import KNeighborsClassifier from sklearn.model_selection import GridsearchCV//3)特征工程:标准化 transferStandardScaler() x traintransfer.fit_transform(x_train) x_testtransfer.transform(x_test)//4)KNN算法预估器 estimatorKNeighborsClassifier() //加入网格搜索与交叉验证 param_dict {n_neighbors:[1,3,5,7,9,11]} estimatorGridSearchCV(estimator,param_gridparam_dict,cv3) estimator.fit(x_train,y_train)//5)模型评估 //方法1:直接比对真实值和预测值 y_predictestimator.predict(x_test) print(y_predict:\n,y_predict) print(直接比对真实值和预测值:\n,y_testy_predict)//方法2:计算准确率 scoreestimator.score(x_test,y_test) print(准确率为:\n,score)//最佳参数:best_params_ print(最佳参数:\n,estimator.best_params_) //最佳结果:best_score_ print(最佳结果:\n,estimator.best_score_) //最佳估计器:best_estimatir_ print(最佳估计器:\n,estimator,best_estimator_) //交叉验证结果:cv_results_ print(交叉验证结果:\n,estimator.cv_results_)
http://www.zqtcl.cn/news/722931/

相关文章:

  • 织梦装修公司网站模板wordpress主题代码编辑教程
  • 外边做一个网站要多少钱关键词的选取原则
  • 做网站需要备案吗wordpress会员邮件通知
  • 如何在百度创建网站欧宇公司网络建设方案
  • 网站网页设计基本理论视频模板套用免费
  • 外贸人常用的网站伪静态网站
  • 优质的聊城做网站网站建设论文 网站建设论文
  • 网站开发毕设的需求分析设计网站推荐
  • 武夷山景区网站建设优点网站建设服务合同要交印花税吗
  • 电子商务网站建设行情seo推广软件品牌
  • 荆州市住房和城乡建设厅官方网站网站开发加维护需要多少钱
  • 手机网站 cms宁波网站建设团队排名
  • 深圳网站建设怎么样微商城建设
  • 网站建设前台后台教程大安移动网站建设
  • 建设网站的程序国庆节网页设计素材
  • 彩票网站做代理人事外包公司
  • 免费的网站开发工具网站app开发
  • 厦门的服装商城网站建设语种网站建设
  • 云服务器怎么做网站东莞黄江网站建设
  • 地方网站模板德清县新巿镇城市建设网站
  • 昆明传媒网站建设模板兔自用WordPress
  • 高企达建设有限公司网站青村网站建设
  • 网站设计公司服务连锁品牌网站建设
  • 石家庄桥西网站制作公司wordpress 使用插件下载
  • 深圳外贸建站网络推广哪家好制造业小程序网站开发
  • 电子商务网站开发步骤宁波制作网站知名
  • 网站建设所需网站是别人做的 ftp账号吗
  • 网站集约化建设情况的汇报做网站为什么要买网站空间
  • 专业定制网站开发公司中堂东莞网站建设
  • 如何提交网站给百度建立类似淘宝的网站