title: Average between arrays of different length
body: <p>I'm trying to develop a sort of very simple machine learning example to recognize similarity between arrays.
  For this reason I'm trying to calculate the average between 2 arrays with different length.</p>
  
  <p>For example if I have:</p>
  
  <pre><code>array_1 = [0, 4, 5];
  array_2 = [4, 2, 7];
  </code></pre>
  
  <p>The average is: </p>
  
  <pre><code>average_array = [2, 3, 6];
  </code></pre>
  
  <p>But how can I manage to calculate the average if I have the following situation:</p>
  
  <pre><code>array_1 = [0, 4, 5, 10, 7];
  array_2 = [4, 2, 7];
  </code></pre>
  
  <p>As you can see the arrays have a different length.
  Is there an algorithm that I can apply to solve this problems? 
  Does anyone have an idea or some suggestion?</p>
  
  <p>Of course I can consider the missing values of the second array as 0, and evaluate the average as, for example:</p>
  
  <pre><code>average_array = [2, 3, 6, 5, 3.5];
  </code></pre>
  
  <p>or  consider the values as "<strong>null</strong>" and have:</p>
  
  <pre><code>average_array = [2, 3, 6, 10, 7];
  </code></pre>
  
  <p>But are this two approach good?
  Or there is something smarter?</p>
  
  <p>Thanks for your help!!</p>