When I run in matlab on line script, it works. it doesn't show the error . Why doesn't work in R2022b? shown below
Why do I meet the error when using trainNetwork, it shows too many input arguments in Table?
조회 수: 4 (최근 30일)
이전 댓글 표시
When I use the official case given in Matlab, but Matlab always tell me the message:
"Error in using trainNetwork Too many input arguments..
Reason: Incorrect use of table Too many input arguments.."
load WaveformData
numChannels = size(data{1},1);
idx = [3 4 5 12];
figure
tiledlayout(2,2)
for i = 1:4
nexttile
stackedplot(data{idx(i)}', ...
DisplayLabels="Channel " + string(1:numChannels))
xlabel("Time Step")
title("Class: " + string(labels(idx(i))))
end
numObservations = numel(data);
[idxTrain,idxTest] = trainingPartitions(numObservations, [0.9 0.1]);
XTrain = data(idxTrain);
TTrain = labels(idxTrain);
XTest = data(idxTest);
TTest = labels(idxTest);
numHiddenUnits = 120;
numClasses = numel(categories(TTrain));
layers = [ ...
sequenceInputLayer(numChannels)
lstmLayer(numHiddenUnits,OutputMode="last")
fullyConnectedLayer(numClasses)
softmaxLayer
classificationLayer]
options = trainingOptions("adam", ...
MaxEpochs=150, ...
InitialLearnRate=0.01,...
Shuffle="every-epoch", ...
GradientThreshold=1, ...
Verbose=false, ...
Plots="training-progress");
net = trainNetwork(XTrain,TTrain,layers,options);
%please note that this an official case in MATLAB shown below.
% "https://ww2.mathworks.cn/help/deeplearning/ref/trainnetwork.html#mw_408bdd15-2d34-4c0d-ad91-bc83942f7493"
답변 (1개)
Omega
2024년 9월 20일
Hi Long,
I understand that you are facing issues with the "trainNetwork" MATLAB function. I believe the reason for the issue is a version mismatch. You are using MATLAB R2022b Desktop and referring to an example mentioned in the "trainNetwork" documentation for MATLAB R2024a. The reason you are able to run the script on MATLAB Online is that MATLAB Online uses the latest version.
I suggest you refer to the following documentation link for MATLAB R2022b:
Alternatively, you can update MATLAB to the latest version. Additionally, the "trainNetwork" function is not recommended from R2024a onwards, and you might want to consider using the "trainNet" function instead. The "trainNet" function has several advantages over the "trainNetwork" function.
For further information, you can refer to the following documentation links for the latest MATLAB versions:
I hope it helps!
참고 항목
카테고리
Help Center 및 File Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!