Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Predict responses using a trained deep learning neural network

You can make predictions using a trained neural network for deep learning on
either a CPU or GPU. Using a GPU requires
Parallel
Computing Toolbox™ and a CUDA^{®} enabled NVIDIA^{®} GPU with compute capability 3.0 or higher. Specify the hardware requirements using the
`ExecutionEnvironment`

name-value pair argument.

`YPred = predict(net,X)`

`YPred = predict(net,sequences)`

`YPred = predict(___,Name,Value)`

predicts responses with additional options specified by one or more name-value pair arguments.`YPred`

= predict(___,`Name,Value`

)

When making predictions with sequences of different lengths, the mini-batch size can impact the amount of padding added to the input data which can result in different predicted values. Try using different values to see which works best with your network. To specify mini-batch size and padding options, use the `'MiniBatchSize'`

and `'SequenceLength'`

options.

If the image data contains `NaN`

s, `predict`

propagates them through the network. If the network has ReLU
layers, these layers ignore `NaN`

s. However, if the network does not
have a ReLU layer, then `predict`

returns NaNs as
predictions.

All functions for deep learning training,
prediction, and validation in Deep Learning
Toolbox™ perform computations using single-precision, floating-point arithmetic. Functions
for deep learning include `trainNetwork`

, `predict`

, `classify`

, and
`activations`

. The
software uses single-precision arithmetic when you train networks using both CPUs and
GPUs.

You can compute the predicted scores and the predicted classes from a trained network
using `classify`

.

You can also compute the activations from a network layer using `activations`

.

For sequence-to-label and sequence-to-sequence classification networks (LSTM
networks), you can make predictions and update the network state using `classifyAndUpdateState`

and `predictAndUpdateState`

.

[1] M. Kudo, J. Toyama, and M. Shimbo. "Multidimensional Curve Classification Using Passing-Through Regions." *Pattern Recognition Letters*. Vol. 20, No. 11–13, pages 1103–1111.

[2] *UCI Machine Learning Repository: Japanese Vowels
Dataset*.
https://archive.ics.uci.edu/ml/datasets/Japanese+Vowels

`activations`

| `classify`

| `classifyAndUpdateState`

| `predictAndUpdateState`