Predicting with a Neural Network explained

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] in this video we'll be discussing what it means for an artificial neural network to predict and we'll also see how to do predictions and code using Kerris in an earlier video we discussed what it means to train a neural network so after this training is completed if we're happy with the metrics that the model gave us for our training and validation data then the next step would be to have our model predict on the data in our test set also recall from our video on train test and validation sets that unlike the train and validation data that would get passed to the model with their respective labels during training when we pass our test data to the model we don't pass the corresponding labels so the model is not aware of the labels for the test set at all so for predicting essentially what we're doing is passing our unlabeled test data to our model and then having our model predict on what it thinks about each sample in the test data these predictions are occurring based on what the model learned during training for example say we trained a model to classify different breeds of dogs based on dog images for each sample image the model outputs which breed it thinks is most likely now say we have our test set and this set of course contains images of dogs our model hasn't yet seen so we pass these to our model and ask it to predict the output for each image remember the model does not have access to the labels for these images this process will tell us how well our model performs on data it hasn't seen before based on how well its predictions match the true labels for the test data this process will also give us some insight on what our model has or hasn't learned for example say we train our model only on images of large dogs but our test set has some images of small dogs when we pass a small dog to our model it likely isn't going to do well at predicting what breed the dog is since it's not been trained very well on smaller dogs in general so we need to make sure that our training and validation sets are representative of the actual data we want our model to be predicting on now aside from running predictions on our test data we can also have our model predict on real-world data once it's deployed to serve its actual purpose so for example if we have this neural net or for classifying dog breeds deploy to a website that anyone could visit and upload an image of their own dog then we'd want to be predicting the breed of the dog based on the image this image would likely not have been one that was included in our training or validation or test sets so this prediction would be occurring with true data from out in the field so hopefully now we have an understanding of what it means to have our neural network predict on data now let's see how we can do these predictions and code using Kerris so I'm here in my Jupiter notebook and the first item we have here is a variable I've called predictions now we're assuming that we already have our model built and trained our model in this example is just this variable here called model so we're setting predictions equal to model dot predict this predict function is what we'll call to actually have the model make the predictions now to the predict function we're passing this variable called scaled test samples this is the variable that's holding our test data then we set our batch size which I'm just setting to 10 here arbitrarily and also our verbosity which is how much do we want to see printed to the screen when we run these predictions I'm choosing 0 here to show nothing now before going forward I just want to mention again that I'm just using this sample model here that we've used in previous videos we're not going to go into any details about the actual model now but if you're interested in building the same model and running these same predictions then check out the videos from my Kerris playlist on pre-processing data and creating a confusion matrix they'll give you the full picture regarding this test data for now we're just showing the concept of how to run predictions in code using Kerris ok so we ran our predictions now let's look at our output so here we're just printing each prediction from each sample in our test set which is stored in our predictions variable and for this sample model we have two output categories and that's represented by these two columns here now these two columns are showing us probabilities for each of the two output categories these are the actual predictions let's call the categories 0 and 1 for simplicity so here we see for the first sample in our test set the model is assigning a 74 percent probability that the sample falls into category 0 and only a 26 probability that it falls into category 1 the second sample is showing us that the models assigning an 85 percent probability to the sample being in category one and only 15% probability that it's in category zero and this occurs for each of the test samples and our predictions variable and again just to reiterate each of these tuples here is a prediction for each test sample and that's really all there is to it in making predictions in Kerris so hopefully now you have an understanding for what it means to have your neural network predict and also how to implement this in code and I hope you found this video helpful if you did please like this video subscribe suggest and comment and thanks for watching [Music] you
Info
Channel: deeplizard
Views: 73,194
Rating: undefined out of 5
Keywords: Keras, deep learning, machine learning, artificial neural network, neural network, neural net, transfer learning, AI, artificial intelligence, Theano, Tensorflow, CNTK, tutorial, cuDNN, GPU, Python, supervised learning, unsupervised learning, Sequential model, image classification, convolutional neural network, CNN, categorical crossentropy, relu, activation function, predictions, stochastic gradient descent, educational, education, fine-tune, data augmentation
Id: Z0KVRdE_a7Q
Channel Id: undefined
Length: 5min 6sec (306 seconds)
Published: Wed Nov 22 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.