San Francisco Crime Classification(Kaggle)

Predict the category of crimes that occurred in the city by the bay

From 1934 to 1963, San Francisco was infamous for housing some of the world’s most notorious criminals on the inescapable island of Alcatraz.

Today, the city is known more for its tech scene than its criminal past. But, with rising wealth inequality, housing shortages, and a proliferation of expensive digital toys riding BART to work, there is no scarcity of crime in the city by the bay.

From Sunset to SOMA, and Marina to Excelsior, this competition’s dataset provides nearly 12 years of crime reports from across all of San Francisco’s neighborhoods. Given time and location, you must predict the category of crime that occurred.

We’re also encouraging you to explore the dataset visually. What can we learn about the city through visualizations like this Top Crimes Map? The top most up-voted scripts from this competition will receive official Kaggle swag as prizes.

预测旧金山的犯罪种类。可用的特征只有时间和地点,预测结果要求给出概率,最后优化的目标函数是logloss。
犯罪数据本身是十分有趣的,简单探索可以发现比如周五的犯罪最多,某些犯罪可能偏向于发生在某些特定地区和特定时间,最常见的犯罪比如偷窃等等。论坛里有很多漂亮的数据可视化的展示。
预测概率,选择了简单的朴素贝叶斯算法,特征中有很多字符串类,需要把他们转化成数值类,如果直接对字符串hash给一个数值,这个数值可能并不能真实反映特征不同种类之间的关系,所以选择二值化处理。这里学会了一个很方便的方法,用pandas的get_dummies。
最后排名50%。

代码:


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值