doubt in index and pred formula
Doubt in index and pred formula
Hey @silpasweta, go through this example and you will understand that,
new_vals = np.unique(vals[:,1],return_counts=True)
The above line will return unique values and their corresponding count,
Suppose now, new_vals = ([1,3,5],[3,1,1]) This means there are 3 points belonging to 1 class, 1 point of 3&5 class each.
index = new_vals[1].argmax()
Now the above line will return index of maximum value second array of new_vals i.e. [3,1,1] so index = 0(since 3 is maximum at 0 idx)
pred = new_vals[0][index]
Now this line will give me the corresponding class having maximum count. so pred = 1.
Hope this resolved your doubt.
Plz mark it as resolved in my doubts section.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.