How argmax() work?

How argmax() is working here?

new_vals[1].argmax()

new_vals[1] Why this is like this?

hey @aditrisriv ,
if you look at the vide again ,
Then you will get new_vals as to be an output of np.unique( something, return_counts = True )
So it will be something like , (unique_values , respective_counts) .
I guess you get this.

So now ,
new_vals[0] = unique_values_array
new_vals[1] = respective_counts

So , now we use agrmax , mean it will give us the index of the max value in an array.
For example , if we have arr = [1,2,3,5,2,2,1]
and do np.argmax(arr) , we will get output as 3 ( index value of 5 in arr ).

Similarly , when we do it on respective_values_array ( used above ) , then we will get the answer as the index of class , which is in majority for a particular query_x point.
And then we use the same index value on unique_values array to the respective class_name.

I hope this helped you understand .
Thank You and Happy Learning :slightly_smiling_face:.

1 Like