Simple neural network (for electricity price prediction) training problem
조회 수: 3 (최근 30일)
이전 댓글 표시
Gonzalo Postigo Omeñaca
2022년 3월 30일
댓글: Gonzalo Postigo Omeñaca
2022년 3월 31일
I'm trying to train the following neural network, it has an input matrix of 26 variables and 6999 samples (I imported the dataset from excel and saved it as a numeric matrix). The output is 1x6999. It is a large data set (I attach it in the message) and using the app Neural Net Fitting the training takes 16 minutes approximately, but when I use my own designed network the training just goes for 6 seconds (and therefore, the results aren't good enough when I test it). I assume I'm not training it correctly, but I don't know where the problem is. I have already tried to change number of maxEpochs, MinitBatchsize or even increasing the number of hidden layers (the training keeps being too short). I know that I should use validation during the training but I guess this is not the problem.
Thank you in advance.
CODE:
X_train=INPUTSP12TRAIN;
Y_train=OUTPUTSP1TRAIN;
X_test=INPUTSP12TEST;
Y_test=OUTPUTSP1TEST;
layers = [
sequenceInputLayer(26,"Name","sequence","Normalization","zscore")
fullyConnectedLayer(200,"Name","fc_1")
reluLayer("Name","relu")
fullyConnectedLayer(1,"Name","fc_2")
regressionLayer("Name","regressionoutput")];
maxEpochs = 50;
miniBatchSize = 20;
options = trainingOptions('adam', ...
'MaxEpochs',maxEpochs, ...
'MiniBatchSize',miniBatchSize, ...
'InitialLearnRate',0.01, ...
'GradientThreshold',1, ...
'Shuffle','every-epoch', ...
'Plots','training-progress',...
'Verbose',0);
net = trainNetwork(X_train,Y_train,layers,options);
Y_pred = predict(net,X_test,'MiniBatchSize',1);
댓글 수: 0
채택된 답변
Image Analyst
2022년 3월 31일
Maybe it's okay. Compare the predictions against the ground truth and see how big the differences are.
I usually run for a few thousand epochs over 30 minutes to a full day, but that's for images.
댓글 수: 3
Image Analyst
2022년 3월 31일
I know you see the RMSE going down to what you see as a small amount but my colleague said that sometime it goes down, then up, then down again (like yours). Since your down/up/down section was so close to the end of your training, I'm not sure it's the best it could be. Plus, like I said, I always do thousands of epochs. Since you did only 50, and it was so fast, it couldn't hurt to try a few thousand epochs.
I know you said that the predictions were already acceptable, but why not try letting it go further -- they may get more acceptable.
You might also try the Regression Learner app. It's on the Apps tab of the tool ribbon if you have the Statistics and Machine Learning Toolbox. There are dozens of models in there and it's possible that one of those standard models will be a better predictor than your deep learning model. The default deep learning models in there are fairly simple I think but I've never encountered a case where it said the Neural Network model was the best one. Usually I find that one of the GPR models is best, but sometimes it's a tree model.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Gaussian Process Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!