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