How To Use Google Colab For Kaggle Competitions
A Look into the Clouds:
Let me just tell you at first, to add the code blocks in medium we need to press,
- Windows: Control + Alt + 6
- Mac: Command + Option + 6
- Linux: Control + Alt + 6
Google Colab is a recent tool by Google, released in order to make Deep Learning dedicated computation highly accessible. It is free and continuously developing.
Since I like to work at a time and place of my preference, therefore, I prefer to have all the import things of my life available in cloud. And, I must say, Cloud is the future. That’s the motivation I have behind using different cloud services. Here I am gonna show you how I linked Kaggle with google colab to get access to the competitions and the data. But first, let share with my thoughts (advantages) of using Colab:
Colab provides GPU as well as CPU as your hardware accelerator for absolutely free.
Here you can see how to change your setting for either GPU or CPU:
Colab is not just ideal for improving python skills but also working with Machine learning especially Deep learning becomes a lot more easier.
- You can run the Github file directly
- Similar with Kaggle data.
Here are the following steps how to link colab with kaggle datasets and with the competitions:
- First, install kaggle using the following command,
!pip install kaggle
2. Store the file in a folder named .kaggle
!mkdir .kaggleimport json
token = {"username":"username","key":"key_id"}
with open('/content/.kaggle/kaggle.json', 'w') as file:
json.dump(token, file)!cp /content/.kaggle/kaggle.json ~/.kaggle/kaggle.json!kaggle config set -n path -v{/content}!chmod 600 /content/.kaggle/kaggle.json!kaggle datasets list!kaggle datasets list -s boxoffice
! kaggle competitions download -c tmdb-box-office-prediction403 - Forbidden
You have to accept the terms of the competition in the Rule section (Twist) in order to get access to download the data.
! kaggle competitions download -c tmdb-box-office-prediction -p /content!unzip \*.zipimport pandas as pd
trainset = pd.read_csv('train.csv')
trainset.head()