The following line of code is giving the error: TypeError: unhashable type: 'numpy.ndarray'.
pids_1 = set([pid_tr_orig[y_tr_orig == 1]])
Variables pid_tr_orig and y_tr_orig are 1D Numpy arrays. How can I fix the error?
Since pid_tr_orig and y_tr_orig are Numpy arrays, the code pid_tr_orig[y_tr_orig == 1] will return a Numpy array. So, you do not have to add [] with set().
Change
to
pids_1 = set(pid_tr_orig[y_tr_orig == 1])
It will fix the error.