Answers for "argmax change dafault value for multiple maxima"

0

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
Posted by: Guest on September-24-2021

Code answers related to "argmax change dafault value for multiple maxima"

Python Answers by Framework

Browse Popular Code Answers by Language