In a machine learning algorithm that I'm using, I need to get the exponential values of something in one of the steps.
This is the step that I'm dealing with right now:
I've already have all the 1+g_j(X_i) etc etc calculated, there's no problem in that. Let's call it calculated_value
.
There's no issue there.
The problem is, when I use math.exp(calculated_value)
, I get an overflow. I then decided to use np.exp(calculated_value)
. I still got an overflow.
Other times, apart from get oveflows, I sometimes get infinities.
An example is:
I have the following number that needs to be raised to the power of e
, which is a Decimal
:
dot1 = 3.55114473577e+256
np.exp(dot1) # <-- this is where I get the error below:
decimal.Overflow: above Emax
What's the solution for this? If there isn't any direct python solution to this, then what would the logarithmic version of the same function, that I could use in place of the function below?
β is going to be used as a coefficient to some variables.