metacountregressor 0.1.207__py3-none-any.whl → 0.1.209__py3-none-any.whl
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.
- metacountregressor/solution.py +45 -11
- {metacountregressor-0.1.207.dist-info → metacountregressor-0.1.209.dist-info}/METADATA +1 -1
- {metacountregressor-0.1.207.dist-info → metacountregressor-0.1.209.dist-info}/RECORD +6 -6
- {metacountregressor-0.1.207.dist-info → metacountregressor-0.1.209.dist-info}/WHEEL +1 -1
- {metacountregressor-0.1.207.dist-info → metacountregressor-0.1.209.dist-info}/LICENSE.txt +0 -0
- {metacountregressor-0.1.207.dist-info → metacountregressor-0.1.209.dist-info}/top_level.txt +0 -0
metacountregressor/solution.py
CHANGED
|
@@ -501,7 +501,7 @@ class ObjectiveFunction(object):
|
|
|
501
501
|
# model specs
|
|
502
502
|
self.endog = None
|
|
503
503
|
# solution parameters
|
|
504
|
-
self._min_characteristics =
|
|
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
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
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,
|
|
@@ -1946,11 +1977,11 @@ class ObjectiveFunction(object):
|
|
|
1946
1977
|
|
|
1947
1978
|
else:
|
|
1948
1979
|
slice_this_amount = self.num_dispersion_params(dispersion)
|
|
1949
|
-
slice_this_amount =
|
|
1980
|
+
slice_this_amount = 0 #TODO handle this
|
|
1950
1981
|
if pvalues[-1] > sig_value:
|
|
1951
1982
|
vio_counts += 1
|
|
1952
1983
|
subpvalues = pvalues[:-slice_this_amount].copy()
|
|
1953
|
-
|
|
1984
|
+
|
|
1954
1985
|
if Kh > 1:
|
|
1955
1986
|
if subpvalues[-1] < sig_value:
|
|
1956
1987
|
subpvalues[-Kh] = 0
|
|
@@ -6437,10 +6468,13 @@ class ObjectiveFunction(object):
|
|
|
6437
6468
|
if not is_delete and is_halton:
|
|
6438
6469
|
if obj_1[self._obj_1] <= self.best_obj_1:
|
|
6439
6470
|
self.pvalue_sig_value = .1
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6471
|
+
try:
|
|
6472
|
+
st, self.pvalue_exceed = self.get_pvalue_info_alt(
|
|
6473
|
+
pvalues, self.coeff_names, self.pvalue_sig_value, dispersion, is_halton, 0, 1)
|
|
6474
|
+
except Exception as pval_exe:
|
|
6475
|
+
print(pval_exe)
|
|
6476
|
+
self.pvalue_exceed = sum(
|
|
6477
|
+
a > self.pvalue_sig_value for a in pvalues)
|
|
6444
6478
|
else:
|
|
6445
6479
|
self.pvalue_exceed = sum(
|
|
6446
6480
|
a > self.pvalue_sig_value for a in pvalues)
|
|
@@ -11,10 +11,10 @@ metacountregressor/pareto_file.py,sha256=whySaoPAUWYjyI8zo0hwAOa3rFk6SIUlHSpqZiL
|
|
|
11
11
|
metacountregressor/pareto_logger__plot.py,sha256=mEU2QN4wmsM7t39GJ_XhJ_jjsdl09JOmG0U2jICrAkI,30037
|
|
12
12
|
metacountregressor/setup.py,sha256=5UcQCCLR8Fm5odA3MX78WwahavxFq4mVD6oq0IuQvAY,936
|
|
13
13
|
metacountregressor/single_objective_finder.py,sha256=jVG7GJBqzSP4_riYr-kMMKy_LE3SlGmKMunNhHYxgRg,8011
|
|
14
|
-
metacountregressor/solution.py,sha256=
|
|
14
|
+
metacountregressor/solution.py,sha256=9bPdfwyxUx-4Z2EsOheCsTXbksdPd5oC-o4fx_rDhNE,284645
|
|
15
15
|
metacountregressor/test_generated_paper2.py,sha256=pwOoRzl1jJIIOUAAvbkT6HmmTQ81mwpsshn9SLdKOg8,3927
|
|
16
|
-
metacountregressor-0.1.
|
|
17
|
-
metacountregressor-0.1.
|
|
18
|
-
metacountregressor-0.1.
|
|
19
|
-
metacountregressor-0.1.
|
|
20
|
-
metacountregressor-0.1.
|
|
16
|
+
metacountregressor-0.1.209.dist-info/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
17
|
+
metacountregressor-0.1.209.dist-info/METADATA,sha256=VTXXMO16oHNwdRfj4gslq4CBPvRHnD3Ro2HGHIG7xH0,23536
|
|
18
|
+
metacountregressor-0.1.209.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
|
19
|
+
metacountregressor-0.1.209.dist-info/top_level.txt,sha256=zGG7UC5WIpr76gsFUpwJ4En2aCcoNTONBaS3OewwjR0,19
|
|
20
|
+
metacountregressor-0.1.209.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|