필터 지우기
필터 지우기

Error using preparets with narxnet

조회 수: 2 (최근 30일)
Chris Wolf
Chris Wolf 2020년 3월 19일
댓글: Muhammad Waqar 2021년 9월 4일
I'm trying to use a closed loop narxnet for some time series prediction, but I'm having trouble getting past the preparets step.
My network is 2 inputs, 1 feedback target
view(net) shows this is correct
However this code throws an error. As far as I can tell, my input/target cell arrays are the size they should be to match the configured network.
% dummy data
X = rand(2,100);
T = rand(1,100);
% set up network
net = narxnet(1:2,1:2,5);
net = closeloop(net);
net = configure(net,X,T);
% Net shows 2 inputs 1 output
view(net)
% convert to cells
X = num2cell(X); % X is 2x100
T = num2cell(T); % T is 1x100
% Here's the problem
[Xs,Xi,Ai,Ts] = preparets(net,X,{},T);
Thanks in advance

채택된 답변

Chris Wolf
Chris Wolf 2020년 3월 20일
Nm, I got it myself. For those with similar problems, you need to use con2seq to turn your input/output matrices into input/output sequential vectors. No idea where you are supposed to read about this step in the documentation, and it seems like something that can be easily handled behind the scenes without having to confuse users.
These days I work with a lot of ML and AI experts, and they laugh at me for insisting on using matlab for everything. I'm starting to think they have a point.
% Instead of:
% X = num2cell(X); % X is 2x100
% T = num2cell(T); % T is 1x100
% Use:
X = con2seq(X);
T = con2seq(T);
  댓글 수: 1
Muhammad Waqar
Muhammad Waqar 2021년 9월 4일
My training is perfect while using con2seq() function. But when i am testing my data for 8 inputs and 8 outputs, its give me an error of
Error using network/sim (line 270)
Number of inputs does not match net.numInputs.
Error in narxnetFcn (line 139)
load_forecast = sim(net,testX1);
Answer of net.numInputs =2 in my case while i have 8 inputs data. Then I have manually changed net.numInputs to 8 but no effect on error.
Now as my input data is changed to cell vector, my network is trained for that data. I need to solve this problem for testing my network. If there is any solution, kindly let me know.
thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by