How to run iPython notebook online for Machine Learning projects

0

Recently Google had a Kaggle image contest with test and train image dataset files that were well over a TB in size. My Macbook Pro with an SSD hard drive has a total of 500GB with about 100GB left on it. I came close to not working on the Kaggle contest simply because the datasets were so massive.

I did write a process that cut the file sizes down significantly, however it was still hard drive prohibitive. So, after a ton of research on how to setup a cloud based iPython notebook, such as setting up servers on Amazon AWS, I found something mind-blowing. Inside Google Drive lives a secret Google project called Colaboratory, or Colabs for short.

What can you do in there? Run Python 3 notebooks. You can also run a Tesla K80 GPU- using Keras, Tensorflow, OpenCV and PyTorch. And it costs nothing. Zero.

Enough selling you on Colabs how about a quick tutorial?

1. Create a folder in your Google Drive

2. Create a Colaboratory file

3. Name your file, but make sure to keep the .ipynb — this is for iPython

4. Use GPU vs. CPU by going to: Edit > Notebook settings or Runtime>Change runtime type and select GPU as Hardware accelerator.

5. Run a bit of Python code just to see how it works:

x = 3
print(type(x)) # Prints ""
print(x) # Prints "3"
print(x + 1) # Addition; prints "4"
print(x - 1) # Subtraction; prints "2"
print(x * 2) # Multiplication; prints "6"
print(x ** 2) # Exponentiation; prints "9"
x += 1
print(x) # Prints "4"
x *= 2
print(x) # Prints "8"
y = 2.5
print(type(y)) # Prints ""
print(y, y + 1, y * 2, y ** 2) # Prints "2.5 3.5 5.0 6.25"

That’s it. You now can run your own iPython files for free with a ton of amazing packages made for machine learning.

LEAVE A REPLY

Please enter your comment!
Please enter your name here