metacountregressor 0.1.206__tar.gz → 0.1.209__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/PKG-INFO +1 -1
  2. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor/solution.py +36 -5
  3. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor.egg-info/PKG-INFO +1 -1
  4. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/LICENSE.txt +0 -0
  5. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/README.rst +0 -0
  6. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor/__init__.py +0 -0
  7. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor/_device_cust.py +0 -0
  8. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor/app_main.py +0 -0
  9. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor/data_split_helper.py +0 -0
  10. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor/halton.py +0 -0
  11. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor/helperprocess.py +0 -0
  12. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor/main.py +0 -0
  13. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor/main_old.py +0 -0
  14. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor/metaheuristics.py +0 -0
  15. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor/pareto_file.py +0 -0
  16. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor/pareto_logger__plot.py +0 -0
  17. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor/setup.py +0 -0
  18. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor/single_objective_finder.py +0 -0
  19. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor/test_generated_paper2.py +0 -0
  20. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor.egg-info/SOURCES.txt +0 -0
  21. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor.egg-info/dependency_links.txt +0 -0
  22. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor.egg-info/not-zip-safe +0 -0
  23. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor.egg-info/requires.txt +0 -0
  24. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/metacountregressor.egg-info/top_level.txt +0 -0
  25. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/setup.cfg +0 -0
  26. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/setup.py +0 -0
  27. {metacountregressor-0.1.206 → metacountregressor-0.1.209}/tests/test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: metacountregressor
3
- Version: 0.1.206
3
+ Version: 0.1.209
4
4
  Summary: Extensive Testing for Estimation of Data Count Models
5
5
  Home-page: https://github.com/zahern/CountDataEstimation
6
6
  Author: Zeke Ahern
@@ -501,7 +501,7 @@ class ObjectiveFunction(object):
501
501
  # model specs
502
502
  self.endog = None
503
503
  # solution parameters
504
- self._min_characteristics = 1
504
+ self._min_characteristics = kwargs.get('_min_vars', 3)
505
505
  self._max_hurdle = 4
506
506
 
507
507
  #Manually fit from analyst specification
@@ -1408,16 +1408,47 @@ class ObjectiveFunction(object):
1408
1408
 
1409
1409
  return transform_set
1410
1410
 
1411
+
1411
1412
  def poisson_mean_get_dispersion(self, betas, X, y):
1413
+ '''
1412
1414
  eVy = self._loglik_gradient(betas, X, y, None, X, None, None, False, False, dispersion=0,
1413
1415
  return_EV=True,
1414
1416
  zi_list=None, draws_grouped=None, Xgroup=None)
1415
1417
 
1416
- ab = ((y - eVy)**2 - eVy)/eVy
1417
- bb = eVy -1
1418
- disp = sm.OLS(ab.ravel(), bb.ravel()).fit()
1419
- gamma = disp.params[0]
1418
+ print('trying thi instead')
1419
+
1420
+ '''
1421
+
1422
+ '''
1423
+ nb_model = sm.GLM(y_long, x_long, family=sm.families.NegativeBinomial()).fit()
1424
+ gamma = nb_model.scale
1425
+
1426
+ '''
1427
+ #poisson way
1428
+ try:
1429
+ num_panels, num_obs, num_features = X.shape # Dimensions of x
1430
+ x_long = X.reshape(-1, num_features) # Reshape to (num_panels * num_obs, num_features)
1431
+ y_long = y.reshape(-1)
1432
+ poisson_model = sm.GLM(y_long, x_long, family=sm.families.Poisson()).fit()
1433
+
1434
+ # Get residual deviance and degrees of freedom
1435
+ residual_deviance = poisson_model.deviance
1436
+ degrees_of_freedom = poisson_model.df_resid
1437
+
1438
+ # Calculate dispersion
1439
+ dispersion = residual_deviance / degrees_of_freedom
1440
+ except:
1441
+ dispersion =1
1442
+
1443
+ #ab = np.abs(((y - eVy)**2 - eVy)/eVy)
1444
+
1445
+ #bb = eVy -1
1446
+ #disp = sm.OLS(ab.ravel(), bb.ravel()).fit()
1447
+ #gamma = disp.params[0]
1420
1448
  #print(f'dispersion is {gamma}')
1449
+ gamma = np.min((dispersion,1))
1450
+ if gamma < 0.05:
1451
+ gamma = 0.05
1421
1452
  return gamma
1422
1453
 
1423
1454
  def validation(self, betas, y, X, Xr=None, dispersion=0, rdm_cor_fit=None, zi_list=None, exog_infl=None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: metacountregressor
3
- Version: 0.1.206
3
+ Version: 0.1.209
4
4
  Summary: Extensive Testing for Estimation of Data Count Models
5
5
  Home-page: https://github.com/zahern/CountDataEstimation
6
6
  Author: Zeke Ahern