Neural Network Same Constant Result Value Problem
显示 更早的评论
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
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 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!