Reputation: 13
I'm new to numpy
, and trying to implement the following equation.
The equation has two parts, and should give a final value called Sigma.
the equation is taken from the paper as below image: image of the equation to provide the result of Sigma
I tried to implement it as below, but when running the code, the value c is giving nan
c = np.sqrt(np.log(2 / np.sqrt( 16 * delta + 1 ) -1 ))
sigma = (c + np.sqrt(np.square(c) + epsilon) ) * s / (epsilon * np.sqrt(2))
appreciate if you can advise on how to implement it in numpy
Upvotes: 0
Views: 217
Reputation: 4761
You are missing a parenthesis. This is the correct formula:
c = np.sqrt(np.log(2/(np.sqrt(16*delta + 1) -1)))
Also, keep in mind that (as the paper states) this is defined only for .
Upvotes: 0
Reputation: 703
You missed a bracket in your code
c = np.sqrt(np.log(2 / (np.sqrt( 16 * delta + 1 ) -1 )))
sigma = (c + np.sqrt(np.square(c) + epsilon) ) * s / (epsilon * np.sqrt(2))
To get a valid c value, you should input delta like 0 < delta < 0.5.
Upvotes: 1