PREPARETS: solved. How to test/predict a/with neural network with a new series of input?

1 回表示 (過去 30 日間)
ErikaZ
ErikaZ 2016 年 10 月 28 日
回答済み: ErikaZ 2018 年 7 月 20 日
Preparets has been solved. I will continue working on my code. Question will be updated if necessary or deleted if no other questions surface.
-----------------------------------------------------------------------------------
I designed a NARX neural network with the following code:
%%The files are attached
load('LeftEMGsInputSeries.mat')
load('LeftAnkleAngleTargetSeries.mat')
load('held_LeftEMGsInputSeriesup.mat')
load('held_LeftAnkleAngleTargetSeriesup.mat')
%%Create a Nonlinear Autoregressive Network with External Input
inputDelays = 10:15;
feedbackDelays = 10:15;
hiddenLayerSize = 10;
perf = [];
net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize);
net = openloop(net);
%%Prepare data and Train network
[inputs,inputStates,layerStates,targets,EWs,SHIFT] = preparets(net,LeftEMGsInputSeries,{},LeftAnkleAngleTargetSeries);
[net,tr] = train(net,inputs,targets,inputStates,layerStates);
%Switch the network to predictive mode
newnet = removedelay(net,10);
And it works. Now, I want to predict an output based on a new set of inputs. Since my new series are not the same size of the original test/train series, I tried to prepare the series with:
[held_inputs,held_inputStates,held_layerStates,held_targets,held_EWs,held_SHIFT] = preparets(net,held_LeftEMGsInputSeriesup,{},held_LeftAnkleAngleTargetSeriesup);
And then use:
Predicted_targets = net(held_inputs, held_inputStates, held_layerStates);
perf = perform(newnet,held_LeftAnkleAngleTargetSeriesup, Predicted_targets);
But I get an error on the preparets line.
Error using preparets (line 78)
Inputs{1,1} is not numeric or logical.
A colleague developed a similar network and his code below works:
[held_back_inputs,held_back_inputStates,held_back_layerStates,held_back_targets,held_back_EWs,held_back_SHIFT] = preparets(net,held_back_inputSeries_altered,{},held_back_targetSeries_altered);
I cannot see the difference. I don't know if the error comes on how the arrays/cells were created. How can I fix this issue?
Thank you,
  2 件のコメント
Zeeshan
Zeeshan 2017 年 9 月 1 日
I am also getting the same error. How did you fixed it?
Regards!
Greg Heath
Greg Heath 2017 年 9 月 5 日
Never delete an unanswered question unless, upon further reflection, the question is obviously stupid.
I say this because, more than a few times, ancient unanswered questions have given me insight for solving questions of both mine and others.
Greg

サインインしてコメントする。

採用された回答

ErikaZ
ErikaZ 2018 年 7 月 20 日
In this case, the data was not as individual cell arrays.
con2seq()
can be use to format the data correctly.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by