Size of predictions and targets must match.

11 visualizaciones (últimos 30 días)
Bahadir
Bahadir el 24 de Nov. de 2025
Comentada: Chuguang Pan el 25 de Nov. de 2025
Dear sir,
I make a LSTM regression. LSTM will take 50x28 input and predict 1x2 output.
50 input sample with 28 channel will equal to 1 output samples with 2 channel.
My dataset is OK. I want this dataset.
XTrain= 838985x1 cell inside 50x28 double
TTrain=838985x1 cell inside 1x2 double
layers = [
sequenceInputLayer(28)
bilstmLayer(200,'OutputMode','sequence')
dropoutLayer(0.2)
bilstmLayer(200,'OutputMode','sequence')
dropoutLayer(0.2)
fullyConnectedLayer(2)];
net = trainnet(XTrain,TTrain,layers,"mse",options);
How can ı solve this unshape station?
Error using trainnet (line 46)
Size of predictions and targets must match.
Size of predictions:
2(C) × 128(B) × 50(T)
Size of targets:
2(C) × 128(B) × 1(T)

Respuesta aceptada

Chuguang Pan
Chuguang Pan el 24 de Nov. de 2025
Movida: Matt J el 24 de Nov. de 2025
@Bahadir. As indicated by the error message, the size of prediction and the target must be equal. I think you should reduce the T dimension before predicting, you can use bilstmLayer with "last" Output mode to reduce T dimension.
  2 comentarios
Bahadir
Bahadir el 25 de Nov. de 2025
Dear @Matt J
ı want that 50 sampling size of prediction will equal to 1 sampling size of target.
LSTM will take 50 sampling point from sensors, after that LSTM will predict 1 sampling point for controller.
is it possible?
Chuguang Pan
Chuguang Pan el 25 de Nov. de 2025
@Bahadir. For the one time step prediction problem, you can preprocess the input multivariable time series as tensor and the output as tensor, where every observation is the one time step target.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos


Versión

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by