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

如何做各大网站广告链接台州网络推广

如何做各大网站广告链接,台州网络推广,上海有几个区最好,遵义网站建设服务数据集:FackebookV : 预测 row id:签⼊事件的id x y:坐标 accuracy: 准确度,定位精度 time: 时间戳 place_id: 签到的位置,需要预测的内容 具体步骤: # 1.获取数据集 # 2.基本数据处理 # 2.1 缩⼩数据…

数据集:FackebookV : 预测

row id:签⼊事件的id

x y:坐标

accuracy: 准确度,定位精度

time: 时间戳

place_id: 签到的位置,需要预测的内容

具体步骤:
# 1.获取数据集
# 2.基本数据处理
# 2.1 缩⼩数据范围
# 2.2 选择时间特征
# 2.3 去掉签到较少的地⽅
# 2.4 确定特征值和⽬标值
# 2.5 分割数据集
# 3.特征工程 -- 特征预处理(标准化)
# 4.机器学习 -- knn+cv
# 5.模型评估

代码如下: 

import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import GridSearchCV# 1.获取数据集
data = pd.read_csv('./train.csv/train.csv')
#print(data.shape)# 2.基本数据处理
# 2.1 缩⼩数据范围
data = data.query("x > 5.0 & x < 5.5 & y > 5.0 & y < 5.5")
#print(data.shape)# 2.2 选择时间特征
# 将时间戳转换为datetime
time = pd.to_datetime(data["time"], unit="s")
# 创建DatetimeIndex
time = pd.DatetimeIndex(time)
# 添加时间特征
data["day"] = time.day
data["hour"] = time.hour
data["weekday"] = time.weekday
#print(data.head())# 2.3 去掉签到较少的地⽅
place_count = data["place_id"].value_counts()  # 统计每个place_id出现的次数
place_count = place_count[place_count > 3]  # 只保留出现次数大于4的place_id
data = data[data["place_id"].isin(place_count.index)]  # 只保留出现次数大于4的place_id
#print(data.shape)# 2.4 确定特征值和⽬标值
x = data[["x", "y", "accuracy", "day", "hour", "weekday"]]
y = data["place_id"]# 2.5 分割数据集
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.25, random_state=22)# 3.特征工程 -- 特征预处理(标准化)
transfer = StandardScaler()
x_train = transfer.fit_transform(x_train)
x_test = transfer.fit_transform(x_test)# 4.机器学习 -- knn+cv
estimator = KNeighborsClassifier()# 4.1 交叉验证,网格搜索
param_grid = {"n_neighbors": [1, 3, 5, 7, 9, 11]}
estimator = GridSearchCV(estimator, param_grid=param_grid, cv=4)  # 交叉验证
estimator.fit(x_train, y_train)# 5.模型评估
# 5.1 准确率
score = estimator.score(x_test, y_test)
print("预测准确率:", score)
# 5.2 预测结果
y_pre = estimator.predict(x_test)
print('预测值是:', y_pre)
# 5.3 其他结果输出
print('最好的模型是:', estimator.best_estimator_)
print('最好的结果是:', estimator.best_score_)

运行结果 

(Pytorch) c:\Users\Wennight531\Desktop\机器学习\day4>cd c:/Users/Wennight531/Desktop/机器学习/day4(Pytorch) c:\Users\Wennight531\Desktop\机器学习\day4>D:/Anaconda/envs/Pytorch/python.exe c:/Users/Wennight531/Desktop/机器学习/day4/facebook_v.py
(73649, 9)
D:\Anaconda\envs\Pytorch\lib\site-packages\sklearn\model_selection\_split.py:725: UserWarning: The least populated class in y has only 1 members, which is less than n_splits=4.warnings.warn(
预测准确率: 0.35588986042469994
预测值是: [7030992969 8318971683 2682286453 ... 2766213441 9106759689 4774756673]
最好的模型是: KNeighborsClassifier(n_neighbors=7)
最好的结果是: 0.34459410529364903

http://www.dtcms.com/wzjs/499832.html

相关文章:

  • 国家网站建设网络营销意思
  • 苹果电脑如何做网站seo有哪些经典的案例
  • 百花广场做网站的公司郑州网站推广排名公司
  • 做网站要学的教程关键词排名优化如何
  • 做响应式网站的公司线下推广的渠道和方法
  • 网站数据没有更新百度答主招募入口官网
  • 做网站的软件名字全拼百度推广收费多少
  • 曲靖网站制作公司什么是优化设计
  • wordpress首页置顶文章奶盘seo伪原创工具
  • 网站的产品图片怎样做清晰百度上做优化
  • 2万元建设网站贵吗百度推广怎么优化
  • 网站微信登录怎么做百度指数是搜索量吗
  • 广州门户网站建设方案莆田百度推广开户
  • 医生在网站上做自我宣传美国搜索引擎
  • 学做美食交流网站有哪些百度经验首页
  • 网站设计 素材全网搜索引擎
  • 河北省石家庄疫情最新情况网站seo快速排名优化的软件
  • 用jsp做的简单网站代码盘多多网盘资源库
  • 深圳价格实惠的网站建设公司网站建设网站定制
  • 做网站卖链接软文代写是什么
  • 在线照片编辑工具青岛seo霸屏
  • 绍兴网站建设报价广州百度推广代理公司
  • wordpress woocommerce台州seo优化
  • 微网站一键导航熊猫关键词工具
  • 网站设计会存在什么问题上海关键词优化按天计费
  • 工业设计就业方向及就业前景站长工具的使用seo综合查询排名
  • 个人网站建设 毕业设计重庆seo杨洋
  • 公司网站建设维保协议网站seo推广优化
  • wordpress西部网站seo哪家做的好
  • 丹阳市网站制作google关键词查询工具