10.11.2016 Views

Learning Data Mining with Python

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Classifying Objects in Images Using Deep <strong>Learning</strong><br />

Our system is nearly set up. We need to install scikit-learn and scikit-image, as well<br />

as matplotlib. We can do all of this using pip3. As a dependency on these, we need<br />

the scipy and matplotlib packages as well, which aren't currently installed on this<br />

machine. I recommend using scipy and matplotlib from apt-get rather than pip3,<br />

as it can be painful in some cases to install it using pip3:<br />

sudo apt-get install python3-scipy python3-matplotlib<br />

sudo pip3 install scikit-learn scikit-image<br />

Next, we need to get our code onto the machine. There are many ways to get this file<br />

onto your computer, but one of the easiest is to just copy-and-paste the contents.<br />

To start <strong>with</strong>, open the I<strong>Python</strong> Notebook we used before (on your computer, not<br />

on the Amazon Virtual Machine). On the Notebook itself is a menu. Click on File<br />

and then Download as. Select <strong>Python</strong> and save it to your computer. This procedure<br />

downloads the code in the I<strong>Python</strong> Notebook as a python script that you can run<br />

from the command line.<br />

Open this file (on some systems, you may need to right-click and open <strong>with</strong> a<br />

text editor). Select all of the contents and copy them to your clipboard.<br />

On the Amazon Virtual Machine, move to the home directory and open nano<br />

<strong>with</strong> a new filename:<br />

cd ~/<br />

nano chapter11script.py<br />

The nano program will open, which is a command-line text editor.<br />

With this program open, paste the contents of your clipboard into this file.<br />

On some systems, you may need to use a file option of the ssh program,<br />

rather than pressing Ctrl + V to paste.<br />

In nano, press Ctrl + O to save the file on the disk and then Ctrl + X to exit the<br />

program.<br />

You'll also need the font file. The easiest way to do this is to download it again from<br />

the original location. To do this, enter the following:<br />

wget http://openfontlibrary.org/assets/downloads/bretan/680bc56bbeeca9535<br />

3ede363a3744fdf/bretan.zip<br />

sudo apt-get install unzip<br />

unzip -p bretan.zip Coval.otf > Coval.otf<br />

[ 262 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!