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

1 Ansicht (letzte 30 Tage)
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

Antworten (1)

Venu
Venu am 15 Feb. 2024
Bearbeitet: Venu am 16 Feb. 2024
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 Kommentar
Nia
Nia am 19 Feb. 2024
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Pattern Recognition and Classification finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by