Mastering the features of Google Colaboratory !!!
By: Tanu N Prabhu
Tags: Machine Learning, Google Colab, Data Science, Google Colaboratory, Google

Source: codementor.io

Google Colaboratory is a research tool for data science and machine learning. It’s a jupyter notebook environment that requires no setup to use. It is by far one of the most top tools especially for data scientists because you don’t have to manually install all the packages and libraries, just import them directly by calling them. Whereas in normal IDE you have to manually install the libraries. And moreover, notebooks are meant for code and explanation, it often should look like a blog post. I have been using Google colab for the past two months and it has been the best tool for me. In this blog, I would be giving you guys some tips and tricks about mastering the Google Colab. Stay tuned read all the points, these were the features that even I was struggling to implement in the first place, now I mastered them. Let’s see the top best features of the Google Colab notebook.

1) Running the cell:

To “Run the Cell” (a cell is a place where you enter either your code or text to be executed), you can either press “Ctrl+Enter” or “Shift+Enter”. I personally use “Shift+Enter” because when you press “Shift+Enter” it runs that particular cell and automatically creates a new cell, which is a handy feature to get things done quickly.

Using “Ctrl+Enter”

Using “Shift+Enter”

2) Uploading files

This can be a really painful task if you follow the steps of some random online tutorials. But I have an easy solution which is a one-step process, you do not need to write extra codes, or perform some extra tasks, whereas you just have to upload manually to the Colab. Here is the way to do it.

The below-shown image clearly indicates that you have to right-click on an arrow mark that looks like “>” at the left-hand side of the cells. When you click that you will find a tab with three options, you just have to select “Files”. Then you can easily upload your file with the help of the “Upload” option. There is one thing that you be aware of, you should upload the file outside the “Samples” folder. There you go your job is done.

Click on the Files tab to upload.

This is how it looks when you upload your file to the colab.

After uploading your file to the Colab.

3) Tutorials in Colab

Did you know Google Colab is not only used to type code but also a good place to learn the concepts about Machine Learning, Pandas, Neural Networks? It’s true that you can find a bunch of tutorials in Colab that you can enhance your skills. To find these tutorials just click the > on your left-hand side and click on “Table of Contents” -> “More Resources” you can find a bunch of tutorials out there.

You can find many tutorials in Colab.

4) Uploading Images in your notebook.

Sometimes you need to upload images to your notebook, just in order to make things clear. Adding images can be sometimes hard when you follow tutorials online. One easy way that I found out was obviously you have to use a free image hosting site in order to render your image in the notebook. To do this use “TinyPic”, which is the best website to upload your images, which gives you a bunch of links to choose from after hosting your images such as HTML, Url, and many more. You can also upload “Videos” to this website.

Choose one of the above links that fit your needs.

Once you upload the image to TinyPic, then you just have to copy the link according to your requirement and then paste it into the “Text” section. There you go your job is done.

Paste the link in the Text section

5) Using Tab to complete the code.

This is one of the best feature in the Colab called “Tab Completion”. Tab Completion is very useful especially when you are not sure about the methods of a function. It displays all the listed methods, and then you can choose the method that you need. In order to do this, you have to just press the “Tab” key on your keyboard and there you go you have a complete list of all the equivalent methods to choose.

Press the Tab key to use this option.

6) Directly Saving to GitHub

Google Colab gives you an option to save your project to your GitHub repository which is a handy option. This option helps one tedious task of uploading your project to your GitHub manually, rather this can save your project automatically to your repository. To do this just click on the “File” tab on top of the screen and then click on the option of “Save a copy in GitHub”.

Click on the File Tab to upload to your GitHub

7) Saving your project as a PDF

This was one of the painful tasks for me unless my professor taught me how to do this. Because sometimes you might have to send the PDF document of your notebook for more readability. Because this IPYNB file is not readable unless you have a parser. So in order to save to a PDF document you just have to click “Ctrl-P” and then click save as “PDF”. There you go your job is done. I know that it’s a simple process, but sometimes these simple processes can be a pain in the ass if you don’t know to do it.

Press Ctrl-P or Print option.

8) Importing the libraries without installing them.

Google Colab gives you a unique feature that not even the best IDE provides such as “Importing the libraries without installations”, you don’t have to manually install any libraries prior to importing them, all you have to do is just tell for example import pandas as pd, per se and then your job is done, gone are those days where you have to type pip install pandas in your command prompt, which is disgusting. This is indeed one of the best features of Google Colab. But sometimes you might want to manually install some external libraries.

The above are the prominent features or tips of using Google Colab, everything is available in Google Colab you just use your brain in order to implement them. Also, I hope that reading this blog has given you a better understanding of how to use Google Colab like a pro. Thank you guys for spending your time reading my blog, stay tuned for more updates. Let me know what is your opinion about this post in the comment section below. Also if you have any doubts regarding the post, the comment section is all yours. Have a nice day.