Open AhmedCode99 opened 9 months ago
In order to avoid dividing by zero, I used the following:
def f(x): # Replace zero values in x with a small positive value to avoid division by zero x_safe = np.where(x == 0, np.finfo(float).eps, x) return np.exp(-1 / x_safe)
It works perfectly. Feel free to use it.
This is a nice idea. I will try to implement and let you know .
smart
In order to avoid dividing by zero, I used the following:
It works perfectly. Feel free to use it.