Please explain the training set for neural network
4 views (last 30 days)
Show older comments
Below is the training set code from matlab example ( https://www.mathworks.com/matlabcentral/fileexchange/28684-electricity-load-and-price-forecasting-webinar-case-study?s_tid=FX_rc1_behav )
Can i know the details regarding the code?
trainInd = data.NumDate < datenum('2008-01-01');-------------how to get numdate ?
trainX = X(trainInd,:);--------------------------What function does this line do?
trainY = data.ElecPrice(trainInd);
disp(trainY)
what is the logic?how many hidden layers are used?Please explain
0 Comments
Accepted Answer
Walter Roberson
on 19 Oct 2020
how to get numdate ?
In the example there "Electricity Load Forecasting using Neural Networks" then you have to look at the first line of the example,
data = fetchDBLoadData('2004-01-01', '2008-12-31');
The code for that function is provided as part of the FEX contribution. It connects to a database and retrieves the data from there. So the data.NumDate information is being retrieved from a database.
What function does this line do?
The comparison on the line above
trainInd = data.NumDate < datenum('2008-01-01');
returns a logical vector, one result for every entry in data.NumDate, that is set to true if the date is before that particular datenum, and false otherwise.
trainX = X(trainInd,:);
is then doing logical indexing, selecting rows of X corresponding to NumDate entries that were before 2008.
what is the logic?
net = newfit(trainX', trainY', 20);
so newfit() is used to create the network. newfit() is documented to be newff() with a plotting function set.
how many hidden layers are used?
When you pass a non-empty value as the third parameter to newfit() or newff() then the number of hidden layers used is one more than the number of entries in the vector. 20 is a vector of length 1, so 2 hidden layers will be used, the first of which will be sized 20 and the second will be whatever size is required by the data.
4 Comments
Walter Roberson
on 19 Oct 2020
"Fitting" assumes that given the same inputs, that there is always the same output. That is not the case for price and load forecasting, which has to take into account trends.
The same applies for pattern recognition.
Time series is the only one of those that looks to me to have potential.
More Answers (0)
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!