NARX/time series network for classification

1 view (last 30 days)
I need to create a network to classify samples into four classes. It seems likely that including previous data points (inputs) as a time series will aid in the classification. Using ntstool and trying to create a NARX or 'Nonlinear Input-Output' network, MATLAB treats the problem as regression rather than classification, even though there are four output neurons; one for each class (it also sets the activation functions to linear and won't let me change this). I therefore complete the wizard and save the network, and then make the following changes:
  • Set the activation function for the output layer to 'softmax'.
  • Set the loss function ('performFcn') to 'crossentropy'.
  • Set the training function ('trainFcn') to 'trainscg'.
  • Include 'plotconfusion' in the 'plotFcns' array.
  • Reinitialise the network.
I then train it; my matrix of inputs is 24 x #samples, and my matrix of targets is 4 x #samples, encoded in one-hot for class membership. However, when I train the network (for the 'Nonlinear Input-Output' (i.e. non-recurrent) network), the output is nonsense... the confusion matrices contain only the value 0, apart from the training confusion matrix, which indicates that all samples are being classified as belonging to class 3. What am I doing wrong? How can you use a NARX or delay neural network in MATLAB for classification? Any help is greatly appreciated - thanks.

Answers (1)

Greg Heath
Greg Heath on 6 May 2018
Do not use Narx.
Determine how many points are necessary for a prediction. Then form input vectors using that dimensionality and treat it as a normal classification problem.
If you have N points and it takes p points to make a classification instead of int(N/p) classifications, you can make N-p by sliding along one point at a time.
Have fun.
Thank you for formally accepting my answer
Greg

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!