<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Erdem Alpkaya on Medium]]></title>
        <description><![CDATA[Stories by Erdem Alpkaya on Medium]]></description>
        <link>https://medium.com/@erdemalpkaya?source=rss-1379a914b7d9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*P6Gubv_KFoW67LDfRzPTug.jpeg</url>
            <title>Stories by Erdem Alpkaya on Medium</title>
            <link>https://medium.com/@erdemalpkaya?source=rss-1379a914b7d9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 14:55:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@erdemalpkaya/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Run Kaggle Kernel on Google Colab]]></title>
            <link>https://medium.com/@erdemalpkaya/run-kaggle-kernel-on-google-colab-1a71803460a9?source=rss-1379a914b7d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a71803460a9</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[google-colab]]></category>
            <category><![CDATA[kaggle]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Erdem Alpkaya]]></dc:creator>
            <pubDate>Mon, 03 Jun 2019 14:50:03 GMT</pubDate>
            <atom:updated>2020-07-11T09:16:11.127Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VNHiGjnk4o0BODAHiRgXaA.jpeg" /></figure><p>If you are interested data and doing some machine learning, you have most likely heard about Kaggle</p><p>Kaggle is the most well-known platform for data and data competitions and has the largest community of data scientists. In Kaggle you can find and publish datasets or choose any competition and try to solve the problem.</p><h4>Kaggle Kernel</h4><p>Kaggle kernel is a cloud-based platform for data science and machine learning. It allows data scientists to share code and analyse in Python and R.</p><p>You can access:</p><ul><li>4 CPUs</li><li>16 GB RAM</li><li>5 GB disk space</li><li>6 hours of continuous execution time K80 GPU instance.</li></ul><p>The last couple of days I had a connection problem with Kaggle kernels where it continued to restart itself restarted again and again. After each restart, I had to run the kernel from the beginning each time!</p><p>Annoying huh?</p><h4>Google Colab</h4><p>Colaboratory is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud.<br>With Collaboratory, you can write and execute code, save and share your analyses, and access powerful computing resources, all for free from your browser.</p><p>Externally we have six more hours GPU running time in Google Colab;</p><ul><li>12 hours of GPU K80 per run for free</li></ul><h4>Connect Colab and Running Kaggle Kernel</h4><p>There are so many useful articles on how to set up Google Colab with Kaggle API, but <a href="https://medium.com/u/5675713d9192">Kevin Luk</a>’s article is one of the easy to follow <a href="https://towardsdatascience.com/downloading-datasets-into-google-drive-via-google-colab-bcb1b30b0166">Downloading Datasets into Google Drive via Google Colab</a>.</p><p>There are just a few additional steps in order of you to set up Google Drive for Kaggle competitions.</p><h4>1. Setting up Google Drive</h4><p>The first step is to create a folder in Google Drive using the folder structure as shown in the below image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*Xs6GsbKlncElQZoUg8Lw0w.png" /><figcaption>The folder structure in Google Drive for Kaggle</figcaption></figure><p>Now you are ready to move to Google Colab and follow the set-up steps below.</p><ul><li>Mount your Google Drive files<br>Following code make mount your google drive</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8bf31a17ab126e993000db5270786a99/href">https://medium.com/media/8bf31a17ab126e993000db5270786a99/href</a></iframe><pre>#this will prompt you to upload the kaggle.json</pre><p><strong>Note</strong>: you will need authorization.<br>Click the link in collab and copy-paste the code.</p><ul><li>Check files in Google Colab<br>Refresh the files in Google Colab and your folders should look as shown below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*lQAsvJnc9X0G1MiY__4kkw.png" /><figcaption>Google Drive folders in Google Colab</figcaption></figure><p><strong>2. Kaggle API</strong></p><p>Go to the Kaggle, click the “My Account” section and create a new API Token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*httDKq1wL3y7mJx777NgPQ.png" /><figcaption>API Token</figcaption></figure><p>You will have the Kaggle.json file.</p><ul><li><strong>Upload kaggle.json file to collab</strong></li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0901a27549f8ce37c82e4c6e8e603af9/href">https://medium.com/media/0901a27549f8ce37c82e4c6e8e603af9/href</a></iframe><ul><li><strong>Set up .kaggle directory</strong></li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/43ba279d2034aee106d4148f4a37a667/href">https://medium.com/media/43ba279d2034aee106d4148f4a37a667/href</a></iframe><p>Now you are ready to download the competition datasets and kernels into the Google Drive folder that we created before.</p><p>But first, check the Kaggle API is running the following code</p><pre>!kaggle kernels list — user `Your-User-Name` — sort-by dateRun</pre><p>You should see your kernel list!</p><ul><li><strong>Download any competitions datasets</strong></li></ul><p><strong>Note:</strong> Before doing this part, you need to open Kaggle competition and accept the competition rules!</p><p>First, we need to change the directory. We want to download our dataset in the “input” which is in the competition folder.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/537fe4c4870c818be043b2e0f7049aad/href">https://medium.com/media/537fe4c4870c818be043b2e0f7049aad/href</a></iframe><p>Check your directory before</p><pre>!pwd</pre><p>download the datasets</p><pre>!kaggle competitions download -c ‘name-of-competition’</pre><p><strong>Note:</strong> If your file is a zip file you can unzip with the following code</p><pre>!unzip -q file[.zip] -d [exdir]</pre><ul><li><strong>Install our Kernel</strong></li></ul><p><strong>Note: </strong>Before doing this step, you need to go to the competitions to create a new kernel and commit it. (Also rename your kernels to make your work easier)</p><p>Change the directory again in notebook folder</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/95b07338caa7e27dafe3e5ac9bd19ec7/href">https://medium.com/media/95b07338caa7e27dafe3e5ac9bd19ec7/href</a></iframe><p>Check your directory</p><pre>!pwd</pre><p>Pull your kernel, it is essential to add “-m” for generating when pulling the kernel.</p><pre># user-name/kernel-name you can copy paste from your kernel list<br>!kaggle kernels pull USER-NAME/YOUR-KERNEL-NAME -m</pre><p>You should see the same folder path as shown in the image below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*27UxWW4anm1VPL4NUDuFDA.png" /></figure><ul><li><strong>Open the kernel</strong></li></ul><p>Go to the Google Drive and find the .ipynb files which we pulled with the API<br>right-click the file and open with Collaboratory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yFxTSZSNw6QsnUI6Pc6qtQ.png" /></figure><p><strong>Note:</strong> When you open the notebook, and if you try to run you will get a “No such file or directory: ‘../input’” error<br>because Collab root directory is /content, so you need to change the directory of the new notebook.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/95b07338caa7e27dafe3e5ac9bd19ec7/href">https://medium.com/media/95b07338caa7e27dafe3e5ac9bd19ec7/href</a></iframe><p>Now you are ready<a href="https://emojipedia.org/party-popper/">🎉</a></p><p>After when you finish, you can push the file to Kaggle.</p><pre>!kaggle kernels push</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SNbS0KA-CvjeL31B-y8BAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nAX49Jnv-gCoL2nB1P8AKQ.png" /></figure><p>Please note that unfortunately when you finish your session in Google Colab you will need to start the set up again. Please let me know if you have any difficulty.</p><p>Thanks.</p><h4>Credits</h4><p>Thanks to <a href="https://medium.com/u/5675713d9192">Kevin Luk</a> for the great post</p><h4>References</h4><p><a href="https://github.com/Kaggle/kaggle-api">https://github.com/Kaggle/kaggle-api</a></p><p><a href="http://colab.research.google.com/">Google Colaboratory</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a71803460a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>