during results_log = reg_log.fit(), error encounter but code runs
C:\Users\Kanva\anaconda3\lib\site-packages\statsmodels\discrete\discrete_model.py:1819: RuntimeWarning: overflow encountered in exp
return 1/(1+np.exp(-X))
C:\Users\Kanva\anaconda3\lib\site-packages\statsmodels\discrete\discrete_model.py:1872: RuntimeWarning: divide by zero encountered in log
return np.sum(np.log(self.cdf(q*np.dot(X,params))))
also, on running results_log.summary() ---
where am I wrong?.. or what setting do I need to edit to not encounter such error in the future?
Hey Kanva,
Thank you for your question!
Unfortunately, I don't see any immediate errors with the code. Could you try restarting your notebook using the button shown below and then running the code again? Is the error still there?
If yes, could you tell me which version of statsmodels you are using? This you can do by typing
import statsmodels
statsmodels.__version__
anywhere in the notebook. Could you also tell me the name of the notebook you are trying to run? Have you made any changes to the code or are you using the original version of the notebook?
Kind regards,
365 Hristina
I tried once more and I noticed that I did pd.get_dummies for mapping instead of .map(...)... and the latter seemed to give me the correct results without the earlier error...
But.. is there a difference between these 2 methods??..
data = pd.get_dummies(raw_data, drop_first = True)
data = data.rename(columns = {"Admitted_Yes":"Admitted"})
v/s
data = raw_data.copy()
data['Admitted'] = data['Admitted'].map({'Yes':1,'No':0})
I printed data and it looked the same to me
so.. I compared the data type in the 2 cases..
pd.get_dummies's 1's and 0's are numpy.uint8 while .map one's are numpy.int64
I guess that's why the error was thrown... should I just avoid .get_dummies() or something else?... pls suggesttt....
Thanksz!