You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for your great codes. However, I am wondering how to deal with the negative value appearing in the np.log() and np.sqrt() function when calculating the density.
For example, for the OzakiDensity, Kt can be negative if 1 + self._model.drift(x0, t) * (np.exp(self._model.drift_x(x0, t) * t) - 1) / ( x0 * self._model.drift_x(x0, t)) < -1, and Vt can be negative when performing Vt=np.sqrt(Vt)
Thanks for your great question! I have rewritten the Ozaki density function to make clear that each of these terms is indeed well-defined (this form is also more efficient :). You can see that (exp(x*t) -1)/x is always positive for positive t ):
Also, I removed the if z <=0 expression from above, as you mention this is not going to be optimal, and its better that if something like this happens we should return a nan value, allowing the optimizer to adapt the parameters accordingly
Hi, Justin
Thanks for your great codes. However, I am wondering how to deal with the negative value appearing in the
np.log()
andnp.sqrt()
function when calculating the density.For example, for the OzakiDensity,
Kt
can be negative if1 + self._model.drift(x0, t) * (np.exp(self._model.drift_x(x0, t) * t) - 1) / ( x0 * self._model.drift_x(x0, t)) < -1
, andVt
can be negative when performingVt=np.sqrt(Vt)
Thanks in advance for any suggestion! I am not sure if the strategy you did for other densities is optimal, e.g.,
pymle/pymle/TransitionDensity.py
Lines 182 to 183 in 6344c2e
Could you kindly share some references for handling this negative values like returning zero?
Best,
Shanchao
The text was updated successfully, but these errors were encountered: