classifyAndUpdateState
Classify data 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
a Parallel Computing Toolbox™ license and a supported GPU device. For information about supported devices, see
GPU Computing Requirements (Parallel Computing Toolbox). Specify the hardware requirements using the ExecutionEnvironment
name-value argument.
For networks with multiple outputs, use the predictAndUpdateState
function instead and set the ReturnCategorical
option to true
.
[
classifies the data in updatedNet
,Y
] = classifyAndUpdateState(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 class labels for the data in the numeric arrays or cell arrays
updatedNet
,Y
] = classifyAndUpdateState(recNet
,X1,...,XN
)X1
, …, XN
for the multi-input network
recNet
. The input Xi
corresponds to the
network input recNet.InputNames(i)
.
[
predicts the class labels for the multi-input network updatedNet
,Y
] = classifyAndUpdateState(recNet
,mixed
)recNet
with data of mixed data types.
[
also returns the classification scores corresponding to the class labels using any
of the previous syntaxes.updatedNet
,Y
,scores
] = classifyAndUpdateState(___)
___ = classifyAndUpdateState(___,
predicts class labels with additional options specified by one or more name-value
arguments using any of the previous syntaxes. For example,
Name=Value
)MiniBatchSize=27
classifies data 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
Alternatives
To classify data using a recurrent neural network with multiple output layers and
update the network state, use the predictAndUpdateState
function and set the ReturnCategorical
option to 1
(true).
To compute the predicted classification scores and update the network state of a
recurrent neural network, you can also use the predictAndUpdateState
function.
To compute the activations of a network layer, use the activations
function. The activations
function does not update the network state.
To make predictions without updating the network state, use the classify
function or the predict
function.
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
Introduced in R2017bSee Also
sequenceInputLayer
| lstmLayer
| bilstmLayer
| gruLayer
| predictAndUpdateState
| predict
| classify
| resetState