Google Colaboratory for AI Research and Collaboration

Machine learning enthusiasts, rejoice! Google has not only open sourced it’s deep learning framework, Tensorflow. Now, they bring us a new tool to aid in the research and education of machine learning with a Jupyter based research tool called Colaboratory.

Colaboratory is a free tool which allows you to run and share jupyter notebooks all from the cloud. No need to install anything, all you need is a desktop based browser such as chrome and an account with Google and you will have access to a jupyter notebook environment with all the popular data science packages ready to begin coding.

Google Colaboratory

Accessing Colaboratory

To start using Colaboratory, follow this link:

You might need to register and wait for an invitation prior to begin using this tool.

Once you are in, you are greeted with a Hello, Colaboratory notebook with a few code snippets and instructions on how to use the tool. At the end of the notebook are some important links. 

At this point, you can create your own new jupyter notebook with a Python 2 or Python 3 kernel. Only Python is supported at this time.

The Jupyter notebooks you create are stored in your google drive where you can then search, download and upload new notebooks. If you chose to collaborate with others, they can access your notebook and you can work on the same notebook at the same time. When this happens you can see who is in your notebook and realtime the code changes of each of you. Awesome! 

Code Execution

Google automatically provisions a personal linux virtual machine on which your notebooks will run. When you go idle for a while, your virtual machine is recycled. Each virtual machine has a maximum runtime.

Shell Commands

Google allows you to run certain shell commands on your virtual machine. For example, to install additional python libraries using pip or apt-get you can run the following:

!pip install -q matplotlib-venn
!apt-get -qq install -y libfluidsynth1 

Shell commands are preceded by an exclamation mark.

File Upload and Download Sample

Let’s go through a quick demo on how you can save and download files  to your Colaboratory environment.

First create a pandas dataframe with 5 rows and 2 columns which we rename to A and B. At the end, we just use a regular pandas command to save your data frame into a text file.

import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.randn(5, 2))
df.columns = ['A','B']


To view the files in your Colaboratory virtual machine run the shell command: !ls

Google Colaboratory

You will now see the test_dataframe.txt file we just saved under the datalab folder of your virtual machine.

Let’s now download this file to your local pc by running the below python script:

from google.colab import files'test_dataframe.txt')

To upload files manually from your local pc run the following:

from google.colab import files
uploaded = files.upload()

When you execute the above, you get a file upload button where you can then select and load a file from your local PC.

Code Snippets

There are various other ways to load data onto your Colaboratory virtual machine not to mention much additional functionality. You can find these snippets under Tools > Snippets of your Colaboratory Jupyter Notebook.


Colaboratory allows you to easily start building, sharing and collaborating in your machine learning projects. Free and easy to use with great functionality, this is a great new machine learning tool. Thanks Google! 


Advanced analytics professional currently practicing in the healthcare sector. Passionate about Machine Learning, Operations Research and Programming. Enjoys the outdoors and extreme sports.

Related Articles