title: How to Train Brain.js Neural Network in Bulk with Dynamic DataSet?
body: <p>I am having hard time figuring out how to train the brain.js neural network with dynamic dataset. The GitHub documentation says the following: <strong>Each training pattern should have an input and an output, both of which can be either an array of numbers from 0 to 1 or a hash of numbers from 0 to 1</strong></p>
  
  <pre><code>net.train([{input: [0, 0], output: [0]},
             {input: [0, 1], output: [1]},
             {input: [1, 0], output: [1]},
             {input: [1, 1], output: [0]}]);
  
  const output = net.run([1, 0]);  // [0.987]
  </code></pre>
  
  <p>The problem is that I don't know beforehand how many elements are in the input array of my training data so I don't know how many {input: [0, 0], output: [0]} elements I need to pass to net.train().</p>
  
  <p>For example:
  How do I train the neural network if I have the following arrays without hardcoding the number of {input: [0, 0], output: [0]} elements.</p>
  
  <pre><code>var input1_array = [.1, .2, .3, .4, .5]
  var input2_array = [.6, .7, .8, .9, .95]
  var output1_array = [.2, .6, .8, .85, .95]
  
  // the following doesn't work 
  net.train([input:[input1_array, input2_array], output:[output1_array]]);
  </code></pre>