Book Image

Deep Learning with Microsoft Cognitive Toolkit Quick Start Guide

By : Willem Meints
Book Image

Deep Learning with Microsoft Cognitive Toolkit Quick Start Guide

By: Willem Meints

Overview of this book

Cognitive Toolkit is a very popular and recently open sourced deep learning toolkit by Microsoft. Cognitive Toolkit is used to train fast and effective deep learning models. This book will be a quick introduction to using Cognitive Toolkit and will teach you how to train and validate different types of neural networks, such as convolutional and recurrent neural networks. This book will help you understand the basics of deep learning. You will learn how to use Microsoft Cognitive Toolkit to build deep learning models and discover what makes this framework unique so that you know when to use it. This book will be a quick, no-nonsense introduction to the library and will teach you how to train different types of neural networks, such as convolutional neural networks, recurrent neural networks, autoencoders, and more, using Cognitive Toolkit. Then we will look at two scenarios in which deep learning can be used to enhance human capabilities. The book will also demonstrate how to evaluate your models' performance to ensure it trains and runs smoothly and gives you the most accurate results. Finally, you will get a short overview of how Cognitive Toolkit fits in to a DevOps environment
Table of Contents (9 chapters)

Making predictions with a neural network

One of the most satisfying things after training a deep learning model is to actually use it in an application. For now, we'll limit ourselves to using the model with a sample that we randomly pick from our test set. But, later on, in Chapter 7, Deploying Models to Production, we'll look at how to save the model to disk and use it in C# or .NET to build applications with it.

Let's write the code to make a prediction with the neural network that we trained:

sample_index = np.random.choice(X_test.shape[0])
sample = X_test[sample_index]

inverted_mapping = {
1: 'Iris-setosa',
2: 'Iris-versicolor',
3: 'Iris-virginica'
}

prediction = z(sample)
predicted_label = inverted_mapping[np.argmax(prediction)]

print(predicted_label)

Follow the given steps:

  1. First, pick a random item from the test set using...