How not to normalize the data in patternnet function and how to do K-fold cross validation technique?

1 view (last 30 days)
I want to do classification using ANN 'patternnent' function. I am new to ANN. I have already normalised data and also divided into train and test dataset. Further, I want to divide train data into three equal parts and perform cross-validation technique, later I want to apply the best model on test dataset to calculate the accuracy. I am unable to understand how to use the 'patternnet' and other functions and complete the task the way I want. Could you please help me out? Thank you.

Accepted Answer

Greg Heath
Greg Heath on 8 May 2017
Edited: Greg Heath on 8 May 2017
The optimal approach is to learn the best way to take advantage of existing MATLAB functions and structure. Although it is not necessarily the approach that you proposed, it is no less valid.
For example, by default, MATLAB NN design functions automatically
1. Normalize input and target data
2. Divide the data into training, validation and test subsets.
3. Initialize default parameter settings including random initial
weights
4. Train the net until one of several conditions occur. For example
a. Training subset error is reduced to a specified level
b. Validation subset error increases continually for a
specified number (default = 6) of epochs
c. A maximum number (default = 1000) of epochs is reached.
5. Use the target normalization parameters to
unnormalize the output data
6. Calculate the performance measure
Simple examples are given in the help and doc documentation examples obtained using the commands
help patternnet
and
doc patternnet
Typically, there are two main reasons for unsuccessful efforts:
1. Inadequate (high or low) specification for the number of hidden nodes
2. Inappropriate choice of random initial weights.
Consequently, I have devised a double loop approach where
1. The outer loop is over an interval for the number of hidden nodes
2. The inner loop is over a number of random initial weight settings
Examples can be found by searching both NEWSGROUP and ANSWERS using search words that include
GREG PATTERNNET
or
GREG PATTERNNET TUTORIAL
Hope this helps
Thank you for formally accepting my answer
Greg
  2 Comments
Mallikarjun Yelameli
Mallikarjun Yelameli on 9 May 2017
Edited: Mallikarjun Yelameli on 9 May 2017
Thank you so much your reply.
The target data is the label of data. It is arranged using one hot encoding. In the first point, you mentioned that normalise the target data, I didn't understand the logic because it is just showing labels of my data. And also I did not understand the logic of 5th step. I request you to throw some light on this. Thank you.
Greg Heath
Greg Heath on 25 Jul 2017
Edited: Greg Heath on 25 Jul 2017
I don't know what "the label of data" or "one hot encoding" mean to the computer. So I suggest you number the labels from 1 to c (for class) and use columns of the 0-1 unit matrix eye(c) as your target columns.
Then functions IND2VEC and VEC2IND allow transformations from target and output matrices to class indices and vice versa.
Hope this helps.
Greg
PS. Searching the NEWSREADER and ANSWERS with ind2vec and/or vec2ind will result in many examples.

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!