<?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 Piyush Raj on Medium]]></title>
        <description><![CDATA[Stories by Piyush Raj on Medium]]></description>
        <link>https://medium.com/@piyushraj_26143?source=rss-377f4224bb25------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*GOPr0-7Qqg1-ILZtfdkbcg.jpeg</url>
            <title>Stories by Piyush Raj on Medium</title>
            <link>https://medium.com/@piyushraj_26143?source=rss-377f4224bb25------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 12:12:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@piyushraj_26143/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[3 Simple steps : Using Google Colaboratory]]></title>
            <link>https://medium.com/@piyushraj_26143/3-simple-steps-using-google-colaboratory-158757fd5e2d?source=rss-377f4224bb25------2</link>
            <guid isPermaLink="false">https://medium.com/p/158757fd5e2d</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[google-colab]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Piyush Raj]]></dc:creator>
            <pubDate>Tue, 15 Jan 2019 13:35:18 GMT</pubDate>
            <atom:updated>2019-01-15T13:35:18.421Z</atom:updated>
            <content:encoded><![CDATA[<h3>3 Simple steps : Using Google Colaboratory</h3><p>We’ve all had our troubles working with large data files <em>(&gt;500 Megabytes)</em> while not having enough compute on a local machine, if we are lucky we’ll run into a memory error and if not, the system would just FREEZE which not only hampers productivity but is also quite frustrating.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/1*IfBUkRoPEBfNmuOmVMISZQ.jpeg" /></figure><p>But worry not, Google got us covered, introducing Google Colaboratory:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*Lad06lrjlU9UZgSTHUoyfA.png" /></figure><blockquote>Colaboratory is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud.</blockquote><blockquote>Without further ado let’s begin the tutorial,<br>For the purpose of this tutorial I’ll be working with Analytics Vidhya’s AmExpert 2018 (Machine learning hackathon) data which is approximately 750 MB.</blockquote><h3>STEP 1: Upload the data to Google drive</h3><p>Firstly, we’ll have to upload our data to google drive, for this <em>open your drive in the browser → Right Click → Upload the folder containing your data</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*Dy5FWmFwo8U4KA6hr_MrIg.png" /><figcaption>Get this menu by a right click in your drive.</figcaption></figure><p>I am uploading the folder <em>amexpert_2018</em> which contains the data folder storing files<em> train.csv, test.csv and historical_user_logs.csv. </em>The <em>historical_user_logs.csv</em> is 755 MB (this is file I’m gonna load as a dataframe). Now, depending on the size of your file and your internet connection this step can take from a few minutes to a few hours.</p><h3>STEP 2: Start a new Colab Environment</h3><p>Once the folder has been uploaded, navigate to the folder and start a new Google Colab environment which is nothing but a <em>jupyter notebook</em> running on cloud. For this:</p><blockquote>Right click anywhere inside your uploaded floder → More →Colaboratory</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*OsHL4EUZH6W7AGraIV6rOw.png" /></figure><p>This will open a notebook in a new tab of the browser, you can change the runtime specifications of the environment like which version of python to use or whether to use a hardware accelerator like GPU/TPU or not. For this navigate to <em>Runtime → Change runtime type</em> and you’ll see this pop-up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*FQ16MYZwribqJnNnHu1yvw.png" /><figcaption>Choose the settings as per your requirements</figcaption></figure><h3>STEP 3: Mount Your Colab environment to the drive</h3><p>This is the most important step as this is the step that will make the data available in the drive accessible to our colab environment. For this, run the following commands in a code cell.</p><pre>from google.colab import drive<br>drive.mount(‘/content/drive’)</pre><p>This will output a URL, click on the URL, choose your google account and give permission to get the<strong> authorization code</strong>, paste the authorization code in the textbox displayed and hit enter. You should see a similar screen on successful mounting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ggnaxmR3ChdCCraYx5SM-Q.png" /><figcaption>After successful mount</figcaption></figure><p>Now you’re ready to work on your data, but before you do so change the current directory to the one you want to work in <em>(the one storing your data), </em>for this we’ll use the <strong>os library</strong>, and use the following commands</p><pre>import os<br>os.chdir(&#39;drive/My Drive/amexpert_2018&#39;)</pre><p>You can check whether you are at the right directory by this commad:</p><pre>! ls</pre><p>This will simply list out the all the files and folders in the current working directory, this should be exactly the contents of the folder you uploaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sJauFIMn47vyEqIv7XY2Vw.png" /></figure><p><strong>THAT’S IT, <em>that is all there is</em></strong> in setting up the environment, now you can proceed in a similar way as you do on your local jupyter notebook environment.</p><p><strong><em>NOTE: </em></strong>Google colab environment by default has popular python libraries like <em>numpy, pandas, sklearn etc</em> but if you need an<em> </em>external library you can install it, for example:</p><pre>! pip install tensorflow</pre><p><em>Hello everyone! I am senior year undergrad at IIT Roorkee (India) with interests in data science and machine learning. The data science and machine learning community online has been incredibly helpful and welcoming, with efforts like these I intend to give back to this awesome community which has been hugely helpful in my learning.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=158757fd5e2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>