Azzera filtri
Azzera filtri

Error in running one-dimensional CNN regression model

2 visualizzazioni (ultimi 30 giorni)
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.

Risposte (1)

Prasannavenkatesh
Prasannavenkatesh il 18 Giu 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.

Categorie

Scopri di più su Sequence and Numeric Feature Data Workflows in Help Center e File Exchange

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by