Reader small image

You're reading from  Deep Learning with Microsoft Cognitive Toolkit Quick Start Guide

Product typeBook
Published inMar 2019
Reading LevelIntermediate
PublisherPackt
ISBN-139781789802993
Edition1st Edition
Languages
Right arrow
Author (1)
Willem Meints
Willem Meints
author image
Willem Meints

Willem Meints is a software architect and engineer with a wide variety of interests. His background in software engineering hasnt stopped him from exploring new areas like machine learning as part of his daily work. This sparked a deep passion for everything related to artificial intelligence and deep learning. Willem studied electronics after his high-school career but quickly discovered he had more fun building applications. This led to his decision to leave the world of electronics and find a career in software engineering. After he finished his bachelor in software engineering he started working for Info Support where hes been working ever since.
Read more about Willem Meints

Right arrow

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...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Deep Learning with Microsoft Cognitive Toolkit Quick Start Guide
Published in: Mar 2019Publisher: PacktISBN-13: 9781789802993

Author (1)

author image
Willem Meints

Willem Meints is a software architect and engineer with a wide variety of interests. His background in software engineering hasnt stopped him from exploring new areas like machine learning as part of his daily work. This sparked a deep passion for everything related to artificial intelligence and deep learning. Willem studied electronics after his high-school career but quickly discovered he had more fun building applications. This led to his decision to leave the world of electronics and find a career in software engineering. After he finished his bachelor in software engineering he started working for Info Support where hes been working ever since.
Read more about Willem Meints