predictAndUpdateState
Predict responses using a trained recurrent neural network and update the network state
Syntax
Description
You can make predictions using a trained deep learning network on either a CPU
or GPU. Using a GPU requires
Parallel Computing Toolbox™ and a supported GPU device. For information on supported devices, see GPU Support by Release (Parallel Computing Toolbox). Specify the hardware requirements using the ExecutionEnvironment
name-value argument.
[
predicts responses for data in updatedNet
,Y
] = predictAndUpdateState(recNet
,sequences
)sequences
using the trained
recurrent neural network recNet
and updates the network
state.
This function supports recurrent neural networks only. The input
recNet
must have at least one recurrent layer such as an
LSTM layer or a custom layer with state parameters.
[
predicts the responses for the data in the numeric or cell arrays
updatedNet
,Y
] = predictAndUpdateState(recNet
,X1,...,XN
)X1
, …, XN
for the multi-input network
recNet
. The input Xi
corresponds to the
network input recNet.InputNames(i)
.
[
makes predictions using the multi-input network updatedNet
,Y
] = predictAndUpdateState(recNet
,mixed
)recNet
with
data of mixed data types.
[updatedNet,
predicts responses for the Y1,...,YM
] = predictAndUpdateState(___)M
outputs of a multi-output network
using any of the previous input arguments. The output Yj
corresponds to the network output recNet.OutputNames(j)
. To
return categorical outputs for the classification output layers, set the ReturnCategorical
option to 1
(true).
[___] = predictAndUpdateState(___,
makes predictions with additional options specified by one or more name-value
arguments using any of the previous syntaxes. For example,
Name=Value
)MiniBatchSize=27
makes predictions using mini-batches of size 27.
Tip
When you make 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, respectively.
Examples
Input Arguments
Output Arguments
Algorithms
When you train a network using the trainNetwork
function, or when you use prediction or validation functions
with DAGNetwork
and
SeriesNetwork
objects, the software performs these computations using single-precision, floating-point
arithmetic. Functions for training, prediction, and validation include trainNetwork
, predict
,
classify
, and
activations
.
The software uses single-precision arithmetic when you train networks using both CPUs and
GPUs.
References
[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
Extended Capabilities
Version History
See Also
sequenceInputLayer
| lstmLayer
| bilstmLayer
| gruLayer
| classifyAndUpdateState
| resetState
| classify
| predict