필터 지우기
필터 지우기

Error in running one-dimensional CNN regression model

조회 수: 2 (최근 30일)
Marvin
Marvin 2023년 5월 17일
답변: Prasannavenkatesh 2023년 6월 18일
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.

답변 (1개)

Prasannavenkatesh
Prasannavenkatesh 2023년 6월 18일
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.

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by