注册一个账号
验证码由谷歌提供,所以一般刷不出来,想想办法。
Start Kaggle
按照官方教程:
- accept the rule
- download the data(from the data tab of the competition page)
- understand the problem
- exploratory Data Analysis, EDA (从这一步开始,可以在Jupyter notebook操作了)
- train, test and ensemble ML models
- upload the prediction as a submission on Kaggle
Windows下,安装Jupyter notebook教程
感谢https://zhuanlan.zhihu.com/p/54302333的教程
安装成功后,在cmd输入:jupyper notebook就可以打开网页版编译器了。
此时浏览器打开的界面,和之前设置的本地文件夹是联动的。
测试Jupyter notebook
以入门题目Titanic为示例,检测Jupyter notebook是否安装成功,以及Kaggle的提交流程。
为了简单起见,选用了SVM模型。
以Pclass的值为数据,Survived为Label。
(只是想走个全过程,所以不要在意正确率)
from sklearn.svm import SVC
import pandas as pd
import numpy as np
train_data = pd.read_csv('train.csv', usecols=[2])
train_label = pd.read_csv('train.csv', usecols=[1])
test_data = pd.read_csv('test.csv', usecols=[1])
#训练模型
clf_rbf = SVC(kernel='rbf')
clf_rbf.fit(train_data,train_label)
#预测
prediction = clf_rbf.predict(test_data)
#Kaggle需要提交最终的csv文件,所以输出一个csv文件:
submission = pd.read_csv('gender_submission.csv')
submission['Survived']=prediction
submission.to_csv('submission2.csv', index=False)
输出submission.csv之后,提交到本次Submit Predictions里面就好了。
直接在Kaggle kernel里编译
- 找一个感兴趣的比赛(house prices)
- 点击“Notebook”,在列表里找一个你喜欢的Notebook作为基础参考(Example Submission)
- 点击右上角“edit my copy”进行修改
- 点击右上角“save version”
- 滚轮往下,找到output模块,点submit