NaN, inf or invalid value detected in endog, estimation infeasible error when training statsmodels GLM model
I am trying to build a GLM model (poisson family) using python statsmodels package on train data. The data I have contains categorical values as exogenous variables and numerical values for my target (endegenous variable). I did standardization for numeric values and one-hot-encoding on categorical values (drop the first level). When I fit the data into the model, I got the following exceptions :
ValueError: NaN, inf or invalid value detected in endog, estimation infeasible.
When creating this model the above error raise :
poisson_model = sm.GLM(endog=y_train, exog=X_train_std, family=sm.families.Poisson(),offset = np.log(X_train_std.EXPOSITION))
But when fitting train data to see the summary output I face this error :
poisson_results = poisson_model.fit(method=lbfgs)
I have checked if there is any infinite or missing values on the train data but there is not :
Can onyone help me to resolve the problem ?
Topic statsmodels linear-regression glm scikit-learn python
Category Data Science