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?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Respuestas (1)
Omega
el 20 de Sept. de 2024
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!
Ver también
Categorías
Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!