Optima . Blog
Published in

Optima . Blog

Submit Kaggle Solutions From Command-line Using Phantomjs

Allowing you to submit programatically, even from your remote machine.

You might have participated in some Kaggle competitions where the dataset was in hundreds of megabytes (compressed!). You most probably used a machine in the cloud that can load this amount of data, train some model, and predict the also-quite-large test set. At this point you’ve become eager to submit your predictions to see your position on that leaderboard. So what do you do? Well, instead of downloading this large submission file to your machine and then uploading it to Kaggle, wouldn’t it be easier if you could just upload that submission from the cloud to Kaggle directly? Or even better, automate the whole submission process?

You can do exactly that, by installing my node package kaggle-submit:

npm install kaggle-submit

then running:

kaggle-submit -s <submission> -u <user> -p <pass> -c <competition>

and that’s it! Head over to your submissions page to see the results.

The package uses phantomjs to launch a headless browser, a.k.a a browser without a window. The package then takes your credentials and logs in to Kaggle just like you would normally do to submit your predictions, it uploads your file to the competition you specified.

It is also worth mentioning kaggle-cli which is a Python library providing an unofficial command line tool, to download and upload data. However, a quick look at the issues and commit history will tell you that it’s functionality has been on and off for some time. This is natural when developing unofficial APIs, since the only way to maintain it is keeping up with the website’s UI/API changes.

We shall do our best efforts in maintaining and developing this one. We hope you find it useful and, please suggest more features, fixes, and improvements on the github repo.

If you liked this post, please tap “♥” ︎and share it with your fellow Kagglers.

We are a team of data scientists and software engineers working to help enterprises makes the most out of their data. Our projects range from data analysis to extract insights, to predictive analytics to support decision making, to scalable production ready data products. Our focus areas are (1) personalization and (2) operational efficiency.



Thoughts on data, technology, startups, and oftentimes, other things.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store