MATLAB Answers

Please explain the training set for neural network

2 views (last 30 days)
NN
NN on 19 Oct 2020
Commented: Walter Roberson on 19 Oct 2020
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

Sign in to comment.

Accepted Answer

Walter Roberson
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

Show 1 older comment
NN
NN on 19 Oct 2020
With neural network fitting tool, which one should i opt for short term price and load forecasting ?
1.Fitting app?
2.Pattern recognition app?
3.Clustering app?
4.Time series app?
Walter Roberson
Walter Roberson on 19 Oct 2020
Sorry, that is not something I have experience with.
Walter Roberson
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.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!