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
Error using load
Unable to find file or directory "WaveformData". It is used in these examples:
Run Sequence Forecasting Using a GRU Layer on an FPGA
Run Sequence Forecasting on FPGA by Using Deep Learning HDL Toolbox
Detect Anomalies in Signals Using deepSignalAnomalyDetector
Sequence Classification Using Deep Learning
Train Network for Sequence Classification
Interpret Deep Learning Time-Series Classifications Using Grad-CAM
Get Started with Deep Network Designer
Pad or Truncate Both Sides of Sequence Data
Pad Sequence Data to Same Length
Train Sequence Classification Network Using Custom Training Loop
Sequence Classification Using 1-D Convolutions
Train Sequence Classification Network Using Data with Imbalanced Classes
Time Series Forecasting Using Deep Learning
Sequence-to-One Regression Using Deep Learning
Get Started with Time Series Forecasting
Time Series Anomaly Detection Using Deep Learning
Build Time Series Forecasting Network Using Deep Network Designer
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
long feifei
long feifei 2024년 9월 20일
편집: long feifei 2024년 9월 20일
When I run in matlab on line script, it works. it doesn't show the error . Why doesn't work in R2022b? shown below

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

답변 (1개)

Omega
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 CenterFile 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!

Translated by