Neural Network Same Constant Result Value Problem

조회 수: 1 (최근 30일)
Adam
Adam 2015년 3월 30일
댓글: Greg Heath 2015년 4월 1일
I am trying to predict using 2 years data with NNet for electricity prices. However when I run the below code my forecast Prices for all year is same result. I did not figure it out where the problem is. Do you have any idea. (For example I get 213.68 for whole hours in a year)
Thank you very much.
% code
% % 1
load('data')
% % 2
[num, text] = xlsread('Holidays.xls');
holidays = text(2:end,1);
% % 3
term='short';
[X, dates, labels] = genPredictors(data, term, holidays);
% % 4
ind = data.ElecPrice==0;
data.ElecPrice(ind) = interp1(find(~ind), data.ElecPrice(~ind), find(ind));
trainInd = data.NumDate < datenum('2014-01-01');
trainX = X(trainInd,:);
trainY = data.ElecPrice(trainInd);
testInd = data.NumDate >= datenum('2014-01-01');
testX = X(testInd,:);
testY = data.ElecPrice(testInd);
testDates = dates(testInd);
save testSet testDates testX testY
clear X data trainInd testInd term holidays dates ans num text
% % 5
reTrain = false;
if reTrain || ~exist('Models\NNModel.mat', 'file')
net = newfit(trainX', trainY', 20);
net.performFcn = 'mae';
net = train(net, trainX', trainY');
save Models\NNModel.mat net
else
load Models\NNModel.mat
end
% % 6
load Data\testSet
forecastPrice = sim(net, testX')';
end
  댓글 수: 1
Greg Heath
Greg Heath 2015년 4월 1일
1.Insufficient commenting
2. Confusing use of reserved words (e.g., text)
3. Use of obsolete functions
>> help newfit newfit Create a fitting network.
Obsoleted in R2010b NNET 7.0. Last used in R2010a NNET 6.0.4.
4. No posting of practice data. Can any of these be used?
help nndatasets

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by