title: Mistake in example code given in the MATLAB documentation for training multiple NN
body: <p>In <a href="https://www.mathworks.com/help/deeplearning/ug/improve-neural-network-generalization-and-avoid-overfitting.html#bss4gz0-38" rel="nofollow noreferrer">the documentation</a> we are training 10 different neural networks, each initialized with different weights and biases. <code>net</code> is the variable for constructing the neural networks, <code>x1</code> is the training dataset, <code>t1</code> is the known labels used in training, <code>x2</code> is the test dataset and <code>t2</code> is the test label. Each neural network is stored in a cell variable <code>NN{}</code>. </p>
  
  <p>After training, the evaluation is done using the test set <code>t2</code> and <code>x2</code>, However, the mse calculation is done using <code>mse(net, t2, y2)</code>I think the correct statement should have been <code>mse(NN{i}, t2, y2)</code> since <code>NN{}</code> is the trained model and not <code>net</code> which is just a structure. Below is the code given in the link.</p>
  
  <p>Should the function call be <code>mse(NN{i}, t2, y2)</code> instead of <code>mse(net, t2, y2)</code>?</p>
  
  <pre><code>net = feedforwardnet(10);
  numNN = 10;
  NN = cell(1, numNN);
  perfs = zeros(1, numNN);
  for i = 1:numNN
    fprintf('Training %d/%d\n', i, numNN);
    NN{i} = train(net, x1, t1);
    y2 = NN{i}(x2);
    perfs(i) = mse(net, t2, y2);
  end
  </code></pre>