TDNN for EMG signal analysis giving this error: "Inputs and targets have different numbers of timesteps." Help?

1 次查看(过去 30 天)
Basically title. We have tried multiple fixes, and changes but we keep getting this error. However, they are of the same timesteps. Could anyone help please?
%% Get Data
%Import Excel File
filename='test1.csv';
data=readmatrix(filename,'NumHeaderLines',1);
%Assign to variable
x=[data(1:63196,1:9)];
X=con2seq(x);
t=[data(1:63196,1) data(1:63196,10)];
T=con2seq(t);
%% Create TDNN
delay = 1:2;
neurons =10;
net=timedelaynet(delay,neurons);
net=configure(net,X,T);
net.numinputs = 8;
net.trainParam.epochs=30;
net=train(net,X,T);
%% Predictions
outputs=net(X);
%% Evaluation
performance=perform(net,T,outputs); %needs to be altered to test it on untrained data

回答(1 个)

Venu
Venu 2024-2-15
编辑:Venu 2024-2-16
Hi @Nia,
Try reshaping x,t before converting them into sequences.This ensures that each column of the matrices became a separate sequence, which is the expected format for a TDNN in MATLAB.
%% Get Data
% Import Excel File
filename = 'test1.csv';
data = readmatrix(filename, 'NumHeaderLines', 1);
% Assign to variable
x = data(1:63196, 1:9);
r1 = length(x);
c1 = size(x, 2);
x = reshape(x, c1, r1);
X = con2seq(x);
t = [data(1:63196, 1) data(1:63196, 10)];
r2 = length(t);
c2 = size(t, 2);
t = reshape(t, c2, r2);
T = con2seq(t);
I reshaped your input (x) and target (t) matrices such that each feature and target becomes a separate sequence. This is done by transposing the matrices so that they have dimensions where rows represent features and columns represent timesteps. You can try using transpose operator also (non-conjugate transpose in your case).
Hope this helps!
  1 个评论
Nia
Nia 2024-2-19
Hiya, this causes the problem of it doesn't have the 8 inputs as inputs for the TDNN. This was the same error as we where getting before.
We tried to transpose it to try to get it to work before, but it no longer seemed to realise the 8 inputs, and doesn't improve performance as each epochs cycles.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Pattern Recognition and Classification 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by