machine-learning.rst: minor editorial changes (#674)

* Incremental commit 1: minor editorial revisons.

Signed-off-by: DougTW <doug.martin@intel.com>

* machine-learning.rst: Minor editorial changes.

Signed-off-by: DougTW <doug.martin@intel.com>

* Applies :command: directive for bundles and capitalizes Figures.

Signed-off-by: Michael Vincerra <michael.vincerra@intel.com>
This commit is contained in:
DougTW
2019-08-02 13:23:03 -07:00
committed by michael vincerra
parent c9fbbdc4de
commit 25819fccd9
@@ -3,13 +3,17 @@
TensorFlow\* machine learning on |CL-ATTR|
##########################################
This tutorial will demonstrate the installation and execusion of a TensorFlow\*
This tutorial demonstrates the installation and execution of a TensorFlow\*
machine learning example on |CL-ATTR|. It uses a Jupyter\* Notebook and MNIST
data for handwriting recognition. 
The initial steps will have you set up a Jupyter kernel and run a Notebook
The initial steps show how to set up a Jupyter kernel and run a Notebook
on a bare-metal |CL| system.
.. contents::
:local:
:depth: 1
Prerequisites
*************
@@ -23,12 +27,12 @@ Before you install any new packages, update |CL| with the following command:
sudo swupd update
Once your system is updated, add the following bundles to your system:
After your system is updated, add the following bundles to your system:
* `machine-learning-web-ui`: This bundle contains the Jupyter application.
* :command:`machine-learning-web-ui`: This bundle contains the Jupyter application.
* `machine-learning-basic`: This bundle contains TensorFlow and other useful
tools.
* :command:`machine-learning-basic`: This bundle contains TensorFlow
and other useful tools.
To install the bundles, run the following commands in your :file:`$HOME`
directory:
@@ -39,7 +43,7 @@ directory:
sudo swupd bundle-add machine-learning-basic
Set up a Jupyter notebook
Set up a Jupyter Notebook
*************************
With all required packages and libraries installed, set up the file structure
@@ -68,8 +72,8 @@ for the Jupyter Notebook.
directory.
.. note::
After installing the `machine-learning basic` bundle, you can find the
example code under
After installing the :command:`machine-learning basic` bundle, you can find the example code under
:file:`/usr/share/doc/tensorflow/MNIST_example.ipynb`.
@@ -91,7 +95,7 @@ The files needed are:
Run the Jupyter machine learning example code
*********************************************
With |CL|, Jupyter, and TensorFlow installed and configured, we can
With |CL|, Jupyter, and TensorFlow installed and configured, you can
run the example code.
#. Go to the :file:`($HOME)/Notebooks` directory and start Jupyter with the
@@ -104,7 +108,8 @@ run the example code.
jupyter notebook
The Jupyter server starts and opens a web browser showing the Jupyter file
manager with a list of files in the current directory, see figure 1.
manager with a list of files in the current directory, as shown in
Figure 1.
.. figure:: figures/machine-learning-1.png
:alt: Jupyter file manager
@@ -112,15 +117,15 @@ run the example code.
Figure 1: The Jupyter file manager shows the list of available files.
#. Click on the :file:`Handwriting` directory. The :file:`MNIST_example.ipynb`
file created earlier should be listed there, see figure 2.
file created earlier should be listed there, as shown in Figure 2.
.. figure:: figures/machine-learning-2.png
:alt: Example file within the Jupyter file manager
Figure 2: The example file within the Jupyter file manager.
#. To run the hand writing example, click on the :file:`MNIST_example.ipynb`
file to load the notebook, see figure 3.
#. To run the handwriting example, click on the :file:`MNIST_example.ipynb`
file to load the notebook, as shown in Figure 3.
.. figure:: figures/machine-learning-3.png
:alt: The loaded MNIST_example notebook
@@ -132,7 +137,7 @@ run the example code.
move to the next.
#. Select the :guilabel:`In [2]` cell and click the |run-cell| button to load
the MNIST data. The successful output is shown on figure 4.
the MNIST data. The successful output is shown on Figure 4.
.. figure:: figures/machine-learning-4.png
:alt: Successful import of MNIST data
@@ -140,15 +145,16 @@ run the example code.
Figure 4: Output after successfully importing the MNIST data.
After the MNIST data was successfully downloaded and extracted into the
After the MNIST data is successfully downloaded and extracted into the
:file:`mnist` directory within the :file:`($HOME)/Notebooks/Handwriting`
directory, four .gz files are present and the four data sets were created:
directory, four .gz files are present and the four data sets are created:
`trainX`, `trainY`, `testX` and `testY`.
#. To inspect the imported data, the function in :guilabel:`In [3]` first
instructs Jupyter to reshape the data into an array of 28 x 28 images and to
plot the area in a 28 x 28 grid. Click the |run-cell| button twice to show
the first two digits in the `trainX` dataset, see figure 5.
the first two digits in the `trainX` dataset. An example is shown in
Figure 5.
.. figure:: figures/machine-learning-5.png
:alt: Function to reshape data.
@@ -158,17 +164,17 @@ run the example code.
#. The :guilabel:`In [4]` cell defines the neural network. It provides the
inputs, defines the hidden layers, runs the training model, and sets up
the output layer, see figure 6. Click the |run-cell| button four times to
perform these operations.
the output layer, as shown in Figure 6. Click the |run-cell| button four
times to perform these operations.
.. figure:: figures/machine-learning-6.png
:alt: Defining, building and training the neural network model
Figure 6: Defining, building and training the neural network model.
Figure 6: Defining, building, and training the neural network model.
#. To test the accuracy of the prediction the system makes, select the
#. To test the accuracy of the prediction that the system makes, select the
:guilabel:`In [8]` cell and click the |run-cell| button. In this example,
the number 6 was predicted with a 99% accuracy, see figure 7.
the number 6 was predicted with a 99% accuracy, as shown in Figure 7.
.. figure:: figures/machine-learning-7.png
:alt: Prediction example
@@ -184,7 +190,7 @@ run the example code.
#. To check the accuracy for the whole dataset, select the :guilabel:`In [10]`
cell and click the |run-cell| button. Our example's accuracy is
calculated as 97.17%, see figure 8.
calculated as 97.17%, as shown in Figure 8.
.. figure:: figures/machine-learning-8.png
:alt: System's accuracy