kaggle心得

本文是一篇关于参加Kaggle比赛的心得体会,主要任务是预测Google商品商店客户的营收。作者首先介绍了研究目的,然后进行了数据探索,包括数据清洗、特征工程,接着拟合了模型,并进行了超参数调节。在特征工程中,删除了异常值,处理了缺失数据,创建了新特征。最后,使用LightGBM模型进行预测,通过网格搜索调优以提高模型性能。
摘要由CSDN通过智能技术生成

一、研究目的

80/20原则被许多企业证明是正确的——只有一小部分客户产生了大部分收入。因此,营销团队面临的挑战是在促销策略上进行适当的投入。

在这个比赛中,选手需要分析一个Google商品商店(也称为GStore,Google swag在这里销售)的客户数据集,以预测每个客户带来的营收。希望其结果是更加可控的,以及更好的使公司利用这些数据进行数据分析,进而管理营销预算。

综上可知,该项目属于回归预测问题

二、数据探索

dir_path = '../input/'
os.listdir(dir_path)
for file in os.listdir(dir_path):
    f_path = dir_path+file
    stat_f = os.stat(f_path)
    n_line = sum(1 for line in open(f_path))
    print('{a} size is {b}M, lines is {c}'.format(a=file, b=round(stat_f.st_size/(1024*1024),3), c=n_line))


可见数据还是很庞大的。

由于数据量太大,先读入前5行看看

%%time
r = 0
for each in open('../input/train.csv'):
    print(each)
    r += 1
    if r > 4:
        break

在这里插入图片描述
columns 共12列:

channelGrouping, date, device, fullVisitorId, geoNetwork, sessionId,  socialEngagementType, totals, trafficSource, visitId, visitNumber, visitStartTime

data内容是取一行看:
可知device、geoNetwork、 totals, trafficSource 是json,
visitStartTime 是时间戳
date 是非标准日期格式

Organic Search,20160902,"{""browser"": ""Chrome"", ""browserVersion"": ""not available in demo dataset"", ""browserSize"": ""not available in demo dataset"", ""operatingSystem"": ""Windows"", ""operatingSystemVersion"": ""not available in demo dataset"", ""isMobile"": false, ""mobileDeviceBranding"": ""not available in demo dataset"", ""mobileDeviceModel"": ""not available in demo dataset"", ""mobileInputSelector"": ""not available in demo dataset"", ""mobileDeviceInfo"": ""not available in demo dataset"", ""mobileDeviceMarketingName"": ""not available in demo dataset"", ""flashVersion"": ""not available in demo dataset"", ""language"": ""not available in demo dataset"", ""screenColors"": ""not available in demo dataset"", ""screenResolution"": ""not available in demo dataset"", ""deviceCategory"": ""desktop""}",1131660440785968503,"{""continent"": ""Asia"", ""subContinent"": ""Western Asia"", ""country"": ""Turkey"", ""region"": ""Izmir"", ""metro"": ""(not set)"", ""city"": ""Izmir"", ""cityId"": ""not available in demo dataset"", ""networkDomain"": ""ttnet.com.tr"", ""latitude"": ""not available in demo dataset"", ""longitude"": ""not available in demo dataset"", ""networkLocation"": ""not available in demo dataset""}",1131660440785968503_1472830385,Not Socially Engaged,"{""visits"": ""1"", ""hits"": ""1"", ""pageviews"": ""1"", ""bounces"": ""1"", ""newVisits"": ""1""}","{""campaign"": "
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值