Blog posts on Data Science, Machine Learning, Data Mining, Artificial Intelligence, Spark Machine Learning

Saturday, September 8, 2018

Getting started with google laboratory for running deep learning applications

What is Google Colab:


We all know that deep learning algorithms improve the accuracy of AI applications to great extent. But this accuracy comes with requiring heavy computational processing units such as GPU for developing deep learning models. Many of the machine learning developers cannot afford GPU as they are very costly and find this as a roadblock for learning and developing Deep learning applications. To help the AI, machine learning developers Google has released a free cloud based service Google Colaboratory - Jupyter notebook environment with free GPU processing capabilities with no strings attached for using this service. It is a ready to use service which requires no set at all.

Any AI developers can use this free service to develop deep learning applications using popular AI libraries like Tensorflow, Pytorch, Keras, etc.

Setting up colab:


Go to google drive → new item → More → colaboratory


This opens up a python Jupyter notebook in browser.


By default, the Jupyter notebook runs on Python 2.7 version and CPU processor. We may change the python version to Python 3.6 and processing capability to GPU by changing the settings as shown below:

Go to Runtime → Change runtime type


This opens up a Notebook settings pop-up where we can change Runtime Type to Python 3.6 and processing Hardware to GPU.


Bingo, your python environment with the processing power of GPU is ready use.

Important things to remember:
  • The supported browsers are Chrome and Firefox
  • Currently only Python is supported
  • We can you use upto 12 hours of processing time in one go
Let’s check if our newly created Jupyter notebook works perfectly. Run below commands and see if we are getting expected results.


By default most frequently used python libraries such as Numpy, Pandas, scipy, Sklearn, Matplotlib etc are pre-installed when we create a notebook. Below we can see plotting

Running Machine Learning example:


Below Python Notebook code shows us an example of multi layer neural network using python and sklearn library.

Full code implementation:



In the next post we see how to import data into Colab environment