Get N maximum values and indices along an axis in a NumPy array
<p>I think this is an easy question for experienced numpy users.</p>

<p>I have a score matrix. The raw index corresponds to samples and column index corresponds to items. For example,</p>

<pre><code>score_matrix = 
  [[ 1. ,  0.3,  0.4],
   [ 0.2,  0.6,  0.8],
   [ 0.1,  0.3,  0.5]]
</code></pre>

<p>I want to get top-M indices of items for each samples. Also I want to get top-M scores. For example,</p>

<pre><code>top2_ind = 
  [[0, 2],
   [2, 1],
   [2, 1]]

top2_score = 
  [[1. , 0.4],
   [0,8, 0.6],
   [0.5, 0.3]]
</code></pre>

<p>What is the best way to do this using numpy?</p>