We'll continue our descent by installing the tools necessary to conduct deep learning. The tools will include R, MXNet (framework for building neural nets in R), Python, and Tensorflow (framework for building neural nets in Python). You might ask why I'm using 2 different languages and 2 different frameworks. Truth be told, I like the way MXNet does classic, feed-forward neural network classifiers. You'll see that the syntax is concise and doesn't require as much fiddling with formatting of data. Unfortunately, MXNet doesn't exhibit the same elegance for more complex network architectures that we'll encounter later in this blog, so we'll use Tensorflow for CNN's (Image classification) and RNN's (time series classification).
So let's install R. First, we'll go to https://cran.r-project.org/bin/windows/base/ to download the latest version of R on Windows:
We'll click the "Download R 3.4.2 for Windows" link to download R (if you're reading this in the distant future, perhaps the R version would change but it likely wouldn't alter the pipeline for installing MXNet too drastically).
Click through the installer and accept the default settings, and R will automagically be installed:
Once that's done, we can install RStudio from https://www.rstudio.com/products/rstudio/download/#download. We'll download the latest installer for Windows 10, which can be found by scrolling down a little bit:
We'll run the installer for RStudio, accepting all the default settings:
A quick aside about the roles of RStudio and R since I don't expect those reading this blog to have extensive statistical proficiency. RStudio is an IDE for programming in R that allows a more intuitive view of datasets we'll be working on and facilitates easy package installation. R is a popular statistical programming language and framework used pervasively in academia. R has packages, like MXNet, which contain pre-built functions that implement functionalities so that we don't have to, such as building a neural network, applying matrix operations, and calculating gradients.
Given that we didn't do anything wrong, we should be able to start up R Studio:
Now we'll install MXNet by executing these 4 lines in RStudio's console:
RStudio will then download a whole bunch of different files (MXNet has a lot of dependencies) and install the package for you. It's really quite magical. After MXNet is successfully installed, you'll see something like this:
At this point, we can really start doing some deep learning. But instead, I'm going to install Python and Tensorflow because we already have our installation caps on. So let's go https://www.python.org/downloads/ and download an installer for the latest version of Python:
If we click the download link and scroll down a bit, we can see the download link for an executable installer for Windows. Let's download that:
And once we run it, choosing the default setting as always, we should see:
To verify its installation, we can attempt to open IDLE. Go ahead and run it by searching your programs and you should be able to open IDLE. IDLE is the very minimal IDE we'll use for programming in Python. It looks like this, although you may have a different color scheme:
To install Tensorflow, we'll have to open a command prompt and execute the following command:
Pip will download a whole bunch of packages that Tensorflow depends on and should say this upon a successful installation:
We can also verify that Tensorflow was installed correctly by importing it in the IDLE console:
The console didn't scream any errors at us, which means that the installation was successful.
So at this point we have all the tools we need to train neural networks. In the next post, I'll attempt to perform a task that was previously discussed in this blog: accurately classifying flower species by their sepal and petal lengths and widths. After that we'll probably get into things that are more interesting.
I think it's very cool that you can do deep learning on your own with these tools. I have experience with R and Python, so I'm eager to see how these work together to build a neural network.
ReplyDeleteI can't wait to see where this goes; this is not a topic we go into deeply in most classes. Being interested in AI of all kinds, and knowing that neural networks are the basis for many of these newer kind, it is great to learn more about deep learning and building such networks.
ReplyDelete