How to arrange input for CNN ?

2 views (last 30 days)
happy aprillia
happy aprillia on 4 Jul 2019
Answered: Sai Bhargav Avula on 18 Jul 2019
Hi, I'm trying to use convolutional neural network for load forecasting with 26 feature to forecast 1 output (response), I have prepared the rack of input and output as
cnn_inp = zeros(featureDimension,1,numResponses,length(xtr(:,1)));
cnn_op = zeros(numResponses,1,numResponses,length(xtr(:,1)));
cat_cnn_op=categorical(cnn_op);
because the output need to be categorical, then I standardize the output between [0 1] and give some bound in which the result is classified into ['max' 'normal' 'min']
I have arranged the output as categorical vector but it still can't work.
Error using trainNetwork (line 154)
Invalid training data. Y must be a vector of categorical responses.
Error in method_comparison (line 370)
net = trainNetwork(cnn_inp,cat_cnn_op,layers,options);
Caused by:
Error using nnet.internal.cnn.util.NetworkDataValidator/assertCategoricalResponseVector (line 136)
Invalid training data. Y must be a vector of categorical responses.
if anyone can help me to resolve this issue, I'll much appriciate. Thank you

Answers (1)

Sai Bhargav Avula
Sai Bhargav Avula on 18 Jul 2019
Hi,
Categorical is the last step you do before passing it to the trainNetwork function. Try creating the categorical array of the output just before your trainNetwork not during the intilization.

Community Treasure Hunt

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

Start Hunting!