Friday 15 August 2014

python - Numpy: np.where function given argmax -


I am trying to do this function on two 2D node arrays: Step 1: Search np. Argmax (b, axis = 1) index step 2: find b [index] & gt; A [coordinator] Step 3: Return value in 2D Boolean array.

I tried to do this:

  np.where ((b & gt; a) & amp;; np.argmax (b, axis = 1). Repeat ((3, -1)), right, wrong)   

But there is no dice any ideas?

Thanks in advance.

Based on your comments, I have the best understanding:

  Output = (NPMX (B, Axis = 1) [..., none] == B) & amp; (B & G; A)   

Where we use Normal Broadcasting, its maximum number is in line b :

  np.max (b, axis = 1) [..., none] == b   

or perhaps obvious:

  NPMX (B, Axis = 1) [..., NP.Newxis] == B    

No comments:

Post a Comment