带你走入Kaggle 竞赛top20%的分析方法

Kaggle (Bike Sharing Demand20%

题目https://www.kaggle.com/c/bike-sharing-demand

Github地址:https://github.com/cqychen/mykaggle/tree/master/Bike%20Sharing%20Demand

强调,特征决定结果的高度,模型决定如何逼近这个高度

数据探探

这是一个关于自行车租赁预测的题目,相当于国内的ofo,摩拜单车啦。

You are provided hourly rental data spanning two years. For this competition, the training set is comprised of the first 19 days of each month, while the test set is the 20th to the end of the month. You must predict the total count of bikes rented during each hour covered by the test set, using only information available prior to the rental period.

 

训练集提供了一个月的前19天的数据使用情况,测试集提供后面20号以后的数据我们主要的任务就是预测20号以后的使用量。  

列名

desc

中文描述

datetime

hourly date + timestamp  

小时日期 和时间戳

season

1 = spring, 2 = summer, 3 = fall, 4 = winter

1:春天  2:夏天  3:秋天  4:冬天

holiday

whether the day is considered a holiday

当天是否是节假日

workingday

whether the day is neither a weekend nor holiday

当天是否是工作日

weather

1: Clear, Few clouds, Partly cloudy, Partly cloudy
2: Mist + Cloudy, Mist + Broken clouds, Mist + Few clouds, Mist
3: Light Snow, Light Rain + Thunderstorm + Scattered clouds, Light Rain + Scattered clouds
4: Heavy Rain + Ice Pallets + Thunderstorm + Mist, Snow + Fog

1:晴,少云,部分多云,部分多云。
2:薄雾+多云,薄雾+破碎的云,薄雾+少量的云,雾
3:小雪,小雨+雷雨+散云,小雨+散云
4:大雨+冰盘+雷雨+雾,雪+雾

atemp

temperature in Celsius

温度

atemp

"feels like" temperature in Celsius

感受到的温度

humidity

relative humidity

湿度

windspeed

wind speed

风速

casual

number of non-registered user rentals initiated

未注册用户的租赁数量

registered

number of registered user rentals initiated

注册用户的租赁数量

count

number of total rentals

总的租赁数量

数据总览

读入数据,看看大致信息:

训练集数据共12列,没有数据缺失。哇咔咔

 


 测试集数据共9列,没有数据缺失。

 

数据明细看看

训练集数据:

测试集数据:


我们可以看到 在测试集中

Casual + register==count

 

 

测试集和训练集合进行拼接,方便做特征工程:

 


日期

我们知道日期的格式是如下:yyyy-MM-dd hh:mm:ss

日期这个东东,基本是要构造出如下的特征:

周几

季度

小时

一年第多少

一年的第多少天

同时可以看到

代码如下

all_df["date"] = all_df.datetime.apply(lambda x : x.split()[0])

all_df["monthnum"] = all_df.datetime.apply(lambda x : int(x.split()[0].split('-')[1]))

all_df["daynum"]=all_df.datetime.apply(lambda x : int(x.split()[0].split('-')[2]))

 

dailyData["hour"= dailyData.datetime.apply(lambda x : int(x.split()[1].split(":")[0]))

dailyData["weekday"= dailyData.date.apply(lambda dateString : calendar.day_name[datetime.strptime(dateString,"%Y-%m-%d").weekday()])



特征工程比模型重要的多,数据的认识非常重要,非常重要非常重要!!!

参考连接

https://www.kaggle.com/viveksrinivasan/eda-ensemble-model-top-10-percentile/notebook

https://www.kaggle.com/c/bike-sharing-demand/discussion/11525

推荐阅读:


python量化学习篇

用Python定投基金|看看巴菲特有坑我们吗?

用Python来分析股票|发现炒股软件里惊人内幕

诺贝尔奖得主教你如何分配炒股仓位 | python量化系列

(视频讲解!!!)python量化 | 10年翻400倍的炒股策略

一个10年翻400倍的策略 | Python量化投资

法码三因子选股模型,有多少人可以跑赢


python学习篇

优雅的Python

利用python操作Excel教程

让你的 Python 代码优雅又地道

Python笔记

python学习笔记

Python小知识:Python 迭代器与生成器

python函数简书

Python常用模块资料

Python 禅道

Python 字符串操作方法大全

Python的编码命名规则

python 数组的del ,remove,pop区别


机器学习篇

机器学习入门科普篇--系列二

机器学习算法的随机数据生成总结

python 数据清洗篇

python 数据清洗篇

想入门深度学习?先理解这25个概念!

自然语言处理中的Attention Model:是什么及为什么

用户画像之用户性别识别

机器学习入门科普篇--系列一

客户流失分析

全球变暖温度分析图

数据挖掘学习笔记--决策树C4.5

决策树你应该知道的几点

决策树的Python实现

机器学习之------K-Means(K均值)

机器学习算法与Python实践之(一)k近邻(KNN)

数据科学的完整学习路径

对线性回归、逻辑回归、各种回归的概念学习




 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值