Borrar filtros
Borrar filtros

Error in running one-dimensional CNN regression model

2 visualizaciones (últimos 30 días)
Marvin
Marvin el 17 de Mayo de 2023
Respondida: Prasannavenkatesh el 18 de Jun. de 2023
Hi,
I'm new to training a CNN regression model, and I need to build one to predict temperature time series data using climate proxy data.
I'm not sure what are functions of various layers, so I'm building a simple CNN model first.
For example, I've temperature time series of length 100 (Y_train=100x1 double) and 45 climate proxy data (X_train=45x100 double), so the input feature number is 45.
I've set my CNN model architecture as follows:
function y_pred = cnn(X_train, X_val, Y_train)
layers = [sequenceInputLayer(45,'MinLength',100)
convolution1dLayer(2,10)
reluLayer
maxPooling1dLayer(2,'Stride',2)
reluLayer
fullyConnectedLayer(1)
reluLayer
regressionLayer];
options = trainingOptions('sgdm', ...
MaxEpochs=500, ...
Verbose=false, ...
Plots='none');
net = trainNetwork(X_train, Y_train, layers, options);
y_pred = predict(net, X_val);
end
When I ran the code, it produces this error message:
I'm unsure where I've done wrong.

Respuestas (1)

Prasannavenkatesh
Prasannavenkatesh el 18 de Jun. de 2023
Hi Marvin,
To solve the error of incompatible input and output sequence lengths, you can try replacing the first layer, i.e, the sequence input layer to sequenceInputLayer(45,'MinLength',1). Hope this solves your problem.

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by