美文网首页
kaggle API

kaggle API

作者: Miliimoulins | 来源:发表于2018-04-27 15:11 被阅读3073次

参考官方:https://github.com/Kaggle/kaggle-api

Install

conda install pip
pip install kaggle

To use the Kaggle API, sign up for a Kaggle account at https://www.kaggle.com. Then go to the 'Account' tab of your user profile (https://www.kaggle.com/<username>/account) and select 'Create API Token'. This will trigger the download of kaggle.json, a file containing your API credentials. Place this file in the location ~/.kaggle/kaggle.json (on Windows in the location C:\Users\<Windows-username>\.kaggle\kaggle.json).

For your security, ensure that other users of your computer do not have read access to your credentials. On Unix-based systems you can do this with the following command:
chmod 600 ~/.kaggle/kaggle.json

Example

1、列出属于Health这一类的所有比赛

kaggle competitions list -s health
ref                                        deadline             category      reward  teamCount  userHasEntered  
-----------------------------------------  -------------------  --------  ----------  ---------  --------------  
hhp                                        2013-04-04 07:00:00  Featured    $500,000       1353           False  
ultrasound-nerve-segmentation              2016-08-18 23:59:00  Featured    $100,000        923           False  
diabetic-retinopathy-detection             2015-07-27 23:59:00  Featured    $100,000        661            True  
msk-redefining-cancer-treatment            2017-10-02 23:59:00  Research     $15,000       1386           False  
second-annual-data-science-bowl            2016-03-14 23:59:00  Featured    $200,000        773           False  
melbourne-university-seizure-prediction    2016-12-01 23:59:00  Research     $20,000        478           False  
data-science-bowl-2017                     2017-04-12 23:59:00  Featured  $1,000,000       1972            True  
intel-mobileodt-cervical-cancer-screening  2017-06-21 23:59:00  Featured    $100,000        848           False  
mens-machine-learning-competition-2018     2018-04-02 23:59:00  Featured     $50,000        934           False  
march-machine-learning-mania-2014          2014-04-08 23:59:00  Featured     $15,000        248           False  

2、下载 <competition_name> 下的Data中所有文件,指定下载路径<path>

kaggle competitions download -c <competition_name> -p <path>

3、下载 <competition_name>下的Data中某个文件 <filename>,指定下载路径<path>

kaggle competitions download -c <competition_name> -f <filename> -p <path>

例:kaggle competitions download -c diabetic-retinopathy-detection -f trainLabels.csv.zip -p /Users/httbser/Datasets/kaggle/DR
4、提交结果

usage: kaggle competitions submit [-h] [-c COMPETITION] -f FILE -m MESSAGE
                                  [-q]

required arguments:
  -f FILE, --file FILE  File for upload (full path)
  -m MESSAGE, --message MESSAGE
                        Message describing this submission

optional arguments:
  -h, --help            show this help message and exit
  -c COMPETITION, --competition COMPETITION
                        Competition URL suffix (use "kaggle competitions list" to show options)
                        If empty, the default competition will be used (use "kaggle config set competition")"
  -q, --quiet           Suppress printing information about download progress
kaggle competitions submit -c diabetic-retinopathy-detection -f sample_submission_favorita.csv.7z -m "My submission message"

How to unzip split files

  • It's fairly safe to assume that the file parts just need to be concatenated together.
    The easiest way to do this is within 7-Zip - navigate to the folder in the 7-Zip file manager, right-click on the first file in the sequence, and select "Combine Files..." from the context menu.

It can also be easily done on the command line.

  • On OS X or Linux: (or if you've got Unix command line tools on Windows using Cygwin or GnuWin32)
    Just cat all zip files in sequence to a single file and use unzip command on that.

For example:

cat file.zip.001 > s.zip 
cat file.zip.002 >> s.zip    # pay attention: >>
cat file.zip.003 >> s.zip

unzip s.zip
  • On Windows:
copy /B input.z* output.zip

BTW, how to split the zip:

You have existing.zip but want to split it into 50M sized parts:

zip existing.zip --out new.zip -s 50m

will create

new.zip
new.z01
new.z02
new.z03
....

相关文章

  • kaggle API配置

    需要两点进行kaggle API配置: github上下载kaggle API kaggle 账户上产生token...

  • kaggle API

    参考官方:https://github.com/Kaggle/kaggle-api Install To use ...

  • Kaggle入门

    如何下载Kaggle上的数据集? 首先要下载Kaggle上对应的API工具,需要先安装Kaggle。 在vsc中输...

  • 使用Kaggle python 包下载Kaggle 数据

    1 在目标服务器上安装 Kaggle Python 包 2 生成Kaggle API Token文件 在Kagg...

  • kaggle API 使用

    在下载kaggle数据集时有时会发现下载速度很慢,有什么方法可以提高下载速度呢,答案是用kaggle API,本文...

  • 在onepanel上使用kaggle api提交结果和下载数据集

    一、首先在kaggle个人资料处生成密钥 帐户”标签并选择“创建API令牌”。这将触发kaggle.json包含您...

  • Kaggle数据集下载

    (1)安装kaggle (2)测试 (3)debug 报错,别急,进入My Account 点击创建新的API T...

  • 数据分析的几点经验之谈

    数据获取渠道: kaggle github的仓库 谷歌高级搜索:搜索带后缀如csv格式 自取:rest api收集...

  • 深度学习中猫🐱和狗🐶的分类 1

    以猫狗分类,讲述深度学习的分类算法。 第1部分,数据集,包括: 下载数据集:使用Kaggle API下载数据集; ...

  • 竞赛相关

    Kaggle 新手入门之路 (完结)Kaggle官网kaggle word-vectors 转载一篇别人 kagg...

网友评论

      本文标题:kaggle API

      本文链接:https://www.haomeiwen.com/subject/qmgblftx.html