Creating a CNTK neural network model

In this section, we'll complete the steps required before creating a predictive neural network and then we will create the neural network itself:

  1. We begin by importing the necessary modules to the project:
import matplotlib.pyplot as plt%matplotlib inlineimport numpy as npfrom sklearn.datasets import fetch_openmlimport randomimport cntk.tests.test_utilsfrom sklearn.preprocessing import OneHotEncoderimport cntk as C # if you have not done this before in the project

The fetch_openml() method of the sklearn modules helps us directly download the dataset used in this example to the project—the MNIST Handwritten Digits dataset. The OneHotEncoder method is used for the one-hot encoding of the labels.

  1. Next ...

Get Hands-On Python Deep Learning for the Web now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.