from numba import jit
@jit
def interim_mk(x, unique_x):
"""
:param x:
:param unique_x:
:return:
"""
tp = np.zeros(unique_x.shape)
for i in range(len(unique_x)):
tp[i] = sum(x == unique_x[i])
return tp
In the function above, I used jit to try and speeden it up. However, it does not seem to help. Both x and unique_x are numpy arrays, is there a way to speeden up this calculation (without using cython)
unique_x = np.unique(x)?