%% Classify Sequences Using a Trained LSTM Network
% Load pretrained network. JapaneseVowelsNet is a pretrained LSTM network trained on the Japanese Vowels dataset as described in [1] and [2]. It was trained on the sequences sorted by sequence length with a mini-batch size of 27.

load JapaneseVowelsNet

% View the network architecture.

net.Layers

% Load the test data.

[XTest,YTest] = japaneseVowelsTestData;

% Classify the test data.

YPred = classify(net,XTest);

% View the labels of the first 10 sequences with their predicted labels.

[YTest(1:10) YPred(1:10)]

% Calculate the classification accuracy of the predictions.

accuracy = sum(YPred == YTest)/numel(YTest)

% Copyright 2019 The MathWorks, Inc.