1

First check this link :

http://www.mathworks.com/matlabcentral/newsreader/view_thread/331830#911882

This a proposed method to create a neural network with train/test/validation data sets. I have a optimization algorithm to optimize neural network inputs,number of neurons and layers (maximum 2) with this structure that presented here:

http://www.mathworks.com/matlabcentral/answers/152947-finding-best-neural-network-structure-using-optimization-algorithms-and-cross-validation

As you see this is main loops structure :

 *Position_1(for weight initialization)*

 for i=1:num_of_loops
 *Position_2(for weight initialization)* 

 - repeating cross validation
 for i=1:num_of_kfolds
 *Position_3(for weight initialization)*
 - Cross validation loop

 end
  end

First question : where should i initialize weights (with configure function of patternent neural network ( I have binary classification problem). position 1, position 2 or position 3?

Second question : where should i put rng(0). In first link we have this function before cross-validation loop. Why should i use this function and where should i set it for my proposed structure?

Ps. I'm using outer loop ( i=1:num_of_loops ) to have more reliable outputs. after finding best model I will use all neural networks of best model structure (num_of_loops*num_of_kfolds), insert out-sample data to them and average between outputs.

Thanks.

Eghbal
  • 3,892
  • 13
  • 51
  • 112

1 Answers1

1

It appears that the question has very much been answered in your thread at MathsWorks.

Question 1: As for the first question, both your previous question here and that of MathsWorks have indicated that Position 3 is a suitable placement for the initialisation of weights.

Question 2: As stated here, 'rng is used once and only once before the outer loop'

Community
  • 1
  • 1
Matthew Spencer
  • 2,265
  • 1
  • 23
  • 28
  • Thank you for answer. So we should save 'rng' and calling it in every calling of these codes by optimization algorithm as cost function or only use 'rng' before ourter loop and have the as random numbers in all loops and different in every calling of cost function? – Eghbal Sep 09 '14 at 04:52
  • My understanding with rng is that it initialises the Random Number Generator for later use with the development of your models. This way, you could define specific numbers for a predictable sequence of numbers (repeat the same experiment twice). Hope this helps! – Matthew Spencer Sep 10 '14 at 00:44