title: Cosine similarity between two ndarrays
body: <p>I have two numpy arrays, first array is of size 100*4*200, and second array is of size 150*6*200. In fact, I am storing the 100 samples of 200 dimensional vector representations of 4 fields in array 1 and 140 samples of 200 dimensional vectors of 6 fields in array 2.</p>
  
  <p>Now I want to compute the similarity vector between the samples and create a similarity matrix.  For each sample, I would like to calculate the similarity between the each combination of fields and store it such that I get a 15000*24 dimensional array.</p>
  
  <p>First 150 rows will be the similarity vector between 1st row of array 1 and 150 rows of array 2, next 150 rows will be the similarity vector between the 2nd row of array 1 and 150 rows of array 2 etc.
  Each similarity vector is # fields in array 1 * # fields in array 2 i.e. 1st element of the similarity vector is cosine similarity between field 1 of array 1 and field 1 of array 2, 2nd element will be the similarity between field 1 of array 1 and field 2 of array 2  and so on with last element is the similarity between last field of array 1 and last field of array 2.</p>
  
  <p>What is the best way to do this using numpy arrays ?</p>