-
Notifications
You must be signed in to change notification settings - Fork 122
Description
Hi,
I am getting this error when trying to run the reconstruction using the NaiveBayesDecoder for example_data_hc.pickle
There is no error when trying to run it on the example data sets.
I am using Ubuntu 19.04 and python3.7
R2s: [0.53720666 0.79702171]
time_elapsed: 38.46179175376892
R2s: [0.65030058 0.77625489]
time_elapsed: 76.14730286598206
R2s: [0.68462371 0.53993597]
time_elapsed: 116.00050210952759
R2s: [0.76831659 0.75020602]
time_elapsed: 153.70069885253906
R2s: [0.53691629 0.64449254]
time_elapsed: 192.6614019870758
/home/blinky/.local/lib/python3.7/site-packages/statsmodels/genmod/families/links.py:521: RuntimeWarning: overflow encountered in exp
return np.exp(z)
/home/blinky/.local/lib/python3.7/site-packages/statsmodels/genmod/families/family.py:430: RuntimeWarning: overflow encountered in multiply
return 2 * resid_dev
/home/blinky/.local/lib/python3.7/site-packages/statsmodels/genmod/families/family.py:134: RuntimeWarning: invalid value encountered in multiply
return 1. / (self.link.deriv(mu)**2 * self.variance(mu))
/home/blinky/.local/lib/python3.7/site-packages/statsmodels/genmod/families/family.py:134: RuntimeWarning: divide by zero encountered in true_divide
return 1. / (self.link.deriv(mu)**2 * self.variance(mu))
/home/blinky/.local/lib/python3.7/site-packages/statsmodels/genmod/generalized_linear_model.py:1163: RuntimeWarning: invalid value encountered in multiply
- self._offset_exposure)
ValueError Traceback (most recent call last)
in
106 #Fit model
107 print('fit')
--> 108 model_nb.fit(X_b_train,y_train)
109
110 #Get predictions
~/.local/lib/python3.7/site-packages/Neural_Decoding-0.1.2.dev0-py3.7.egg/Neural_Decoding/decoders.py in fit(self, X_b_train, y_train)
914 tuning=glm_run(y_train,X_b_train[:,j:j+1],input_xy)
915 if self.encoding_model=='quadratic':
--> 916 tuning=glm_run(y_train_modified,X_b_train[:,j:j+1],input_xy_modified)
917 #Enter tuning curves into matrix
918 tuning_all[j,:]=np.squeeze(tuning)
~/.local/lib/python3.7/site-packages/Neural_Decoding-0.1.2.dev0-py3.7.egg/Neural_Decoding/decoders.py in glm_run(Xr, Yr, X_range)
829 poiss_model = sm.GLM(Yr, X2, family=sm.families.Poisson())
830 try:
--> 831 glm_results = poiss_model.fit()
832 Y_range=glm_results.predict(sm.add_constant(X_range))
833 except np.linalg.LinAlgError:
~/.local/lib/python3.7/site-packages/statsmodels/genmod/generalized_linear_model.py in fit(self, start_params, maxiter, method, tol, scale, cov_type, cov_kwds, use_t, full_output, disp, max_start_irls, **kwargs)
1026 return self._fit_irls(start_params=start_params, maxiter=maxiter,
1027 tol=tol, scale=scale, cov_type=cov_type,
-> 1028 cov_kwds=cov_kwds, use_t=use_t, **kwargs)
1029 else:
1030 self._optim_hessian = kwargs.get('optim_hessian')
~/.local/lib/python3.7/site-packages/statsmodels/genmod/generalized_linear_model.py in _fit_irls(self, start_params, maxiter, tol, scale, cov_type, cov_kwds, use_t, **kwargs)
1164 wls_mod = reg_tools._MinimalWLS(wlsendog, wlsexog,
1165 self.weights, check_endog=True,
-> 1166 check_weights=True)
1167 wls_results = wls_mod.fit(method=wls_method)
1168 lin_pred = np.dot(self.exog, wls_results.params)
~/.local/lib/python3.7/site-packages/statsmodels/regression/_tools.py in init(self, endog, exog, weights, check_endog, check_weights)
46 if check_weights:
47 if not np.all(np.isfinite(w_half)):
---> 48 raise ValueError(self.msg.format('weights'))
49
50 if check_endog:
ValueError: NaN, inf or invalid value detected in weights, estimation infeasible.