Hi ,
in one of the last sections of the practice lab, we use
errors = np.where(y != Yhat)
to get indexes where y and Yhat are different. But if I print “errors”, it says for index 142 and 0 they are different values. If I check for y[0] and Yhat[0], they have the same value. Does somebody know, why thats the case ?
I guess you wanted to use np.argwhere instead?
The code is not from me. It was already there, only to execute. Im only confused why it gives the value 0 back, when y[0] and Yhat[0] are not different. For 142 they are different
I see. 142 is a row index, and 0 is a column index. You need a row index and a column index to identify an array element in a 2D array. Perhaps try to think about how the following line works?
plt.title(f"{y[random_index,0]}, {Yhat[random_index, 0]}")
You may also want to go through the lines in your screenshot, line by line.
Thank you, that makes sense 