Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

argmax change dafault value for multiple maxima

def my_argmax(a):
    rows = np.where(a == a.max(axis=1)[:, None])[0]
    rows_multiple_max = rows[:-1][rows[:-1] == rows[1:]]
    my_argmax = a.argmax(axis=1)
    my_argmax[rows_multiple_max] = -1
    return my_argmax
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #argmax #change #dafault #multiple #maxima
ADD COMMENT
Topic
Name
1+1 =