What is N? What is d2? What is z_pred? I’ll stop there, my point is basically make an MWE so that people can reproduce your issues, and ideally read:
N
d2
z_pred