We will cover the following tasks in 44 minutes:
In this chapter I am going to set up what we’re going to do in this tutorial. I will show you the images we’re going to use, I’ll get you working on the Rhyme Interface and then I will tell you a little about me.
In this chapter we have to do some grunt work and create a vector which will make our lives easier down the road by creating a Vector with the images. There are quicker ways to do this but that’s ok. We will get to know each other better in this chapter. And in case you’re wondering why we’re creating this vector? Hint: For Loop
I will show you how to upload the images into R using EBImage using a ‘for loop’. If you haven’t used a for-loop before just type along. I will explain what it is the for loop is doing while we go through it. If you want to learn more about it don’t stop the video. Wait until after and do a google search - you can learn the for loop in an hour.
Since I pulled down random images all the images are of different sizes. We will need to resize them so they are standard. We will use a resize function to complete this. Easy squeezy.
Reshaping Data for Neural Network
Now we’re done with the pre-processing. From this step on we will be performing basic Neural Network protocol. In this lesson we will be using the array_reshape function which allows us to reshape a multi dimensional array, which in our case is our images.
Creating Training Set
As you are probably aware when doing a Machine Learning problem or in this case a Neural Network we need to create the model using a training set. We then test our model on a testing set to see if it does well. In our case we only have 12 images so we need to figure out how we’re going to set this up. Come on in and we’ll work through this.
Creating Test Set
In this chapter we will be build out the test set. Again since we’re only dealing with 12 images we will only have one image of an airplane and one image of a car. This will work but not ideal. Generally you will want a larger training and test set. But remember this is to show you how to do this in R from scratch.
Creating Labels and One Hot Encoding
We need to set up our labels in this chapter. We will use categorical variables; say “0 or 1”. 0 will represent an airplane and a 1 will represent a car. We do this so that we can pass the images through the network and it will know whether it’s a plane or an automobile at the end of the network.
Neural Network Framework
We will build out the Neural Network framework in this chapter. We will build out a Neural Network with one hidden layer. We will be using the most popular activation functions, Relu and Softmax. Come in and I’ll show you how this is done. And by the way, once you get familiar with this terminology building Neural Networks becomes easier. It takes a couple of models though before you get there. So be patient with yourself.
Running the Model
This is the moment of truth. We will be creating our Neural Network. Let’s get to it! We will need to run it a few times for it to catch. We could change the epochs but instead I just have you re-run it. Come in and you’ll see.
We are going to test the model’s accuracy in this chapter. Remember that we’re using a very small test set. But when we ran the model we saw that it did very well so it likely would do well on a larger test set as well. In any event this course is to show you how to set the problem up. You can make your models as big as you want or as small as the one we are creating today.
How does Model perform on new images?
In this chapter we’re going to test our model on images the model hasn’t seen. I happen to know that it works out pretty good. But I’ll show you how to get there. We will then do a quick overview of the journey we’ve taken and after that conclude.
About the Host (Chris Shockley)
I am a R enthusiast, hiker, and amateur astronomer. My favorite hike is located in Mt. Rainier National Park, my favorite Deep Sky Object is Alberio, and my favorite R package is dplyr (since I use it everyday). I am single too. Maybe because I spend too much time playing? I have a dog named Coog (Lllasa Apso), who would rather be outside than inside, which means I have to take him on a lot of walks. I work as a Data Analyst/Financial Analyst for a Metals Co. located in Seattle, WA. I have been in my current position for 4 years. My hope is that I can help you, even if its with my enthusiasm. Yes you can learn R and the Rhyme Interface will help you. But. You also must take what you learn and practice, practice, practice. So... Let's get after it. See you soon.