metacountregressor 0.1.316__py3-none-any.whl → 0.1.318__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.
@@ -65,7 +65,7 @@ def _plot(x, y, z, xlabel=None, ylabel=None, zlabel=None, filename=None):
65
65
  def dict_mean(dict_list,
66
66
  ignore=None):
67
67
  if ignore is None:
68
- ignore = ['AIC', 'layout', 'fixed_fit', 'rdm_fit', 'rdm_cor_fit', 'zi_fit', 'simple', 'pvalues']
68
+ ignore = ['AIC', 'layout', 'fixed_fit', 'rdm_fit', 'rdm_cor_fit', 'zi_fit', 'simple', 'pvalues', "CAIC"]
69
69
  mean_dict = {}
70
70
  if ignore is None:
71
71
  for key in dict_list[0].keys():
@@ -76,7 +76,13 @@ def dict_mean(dict_list,
76
76
  for key in dict_list[0].keys():
77
77
  if key in ignore:
78
78
  continue
79
- mean_dict[key] = sum(d[key] for d in dict_list) / len(dict_list)
79
+ # Filter out dictionaries that don't have the key
80
+ filtered_values = [d[key] for d in dict_list if key in d]
81
+
82
+ if filtered_values: # Ensure there are values to compute the mean
83
+ mean_dict[key] = sum(filtered_values) / len(filtered_values)
84
+ else:
85
+ mean_dict[key] = None # Or handle missing data differently if needed
80
86
  return mean_dict
81
87
 
82
88
 
@@ -1198,7 +1204,7 @@ class SimulatedAnnealing(object):
1198
1204
  Temp3 = (Temp1 + Temp2) / (w_1 * Temp2 + w_2 * Temp1)
1199
1205
 
1200
1206
  self.best_energy = slns[0]
1201
- low_best = 10000000
1207
+ low_best = 1e5
1202
1208
  for i, val in enumerate(fitness_list):
1203
1209
  low = w_1 * fitness_list[i] + w_2 * fitness_list_2[i]
1204
1210
  if low < low_best:
@@ -2359,7 +2365,7 @@ class Mutlithreaded_Meta(DifferentialEvolution, SimulatedAnnealing, HarmonySearc
2359
2365
  Temp3 = (Temp1 + Temp2) / (w_1 * Temp2 + w_2 * Temp1)
2360
2366
 
2361
2367
  self.best_energy = slns[0]
2362
- low_best = 10000000
2368
+ low_best = 1e5
2363
2369
  for i, val in enumerate(fitness_list):
2364
2370
  low = w_1 * fitness_list[i] + w_2 * fitness_list_2[i]
2365
2371
  if low < low_best:
@@ -123,7 +123,7 @@ class ObjectiveFunction(object):
123
123
  """
124
124
 
125
125
  def __init__(self, x_data, y_data, **kwargs):
126
- self.gbl_best = 1000000.0
126
+ self.gbl_best = 1e5
127
127
  self.run_numerical_hessian = kwargs.get('r_nu_hess', False)
128
128
  self.run_bootstrap = kwargs.get('run_bootstrap', False)
129
129
  self.linear_regression = kwargs.get('linear_model', False)
@@ -459,8 +459,14 @@ class ObjectiveFunction(object):
459
459
 
460
460
  if self.G is not None:
461
461
  #TODO need to handle this for groups
462
- self._distribution = ["trad| " + item for item in self._distribution
462
+ print('group by groups off for now')
463
+ NAH_GROUP = 0
464
+ if NAH_GROUP:
465
+ self._distribution = ["trad| " + item for item in self._distribution
463
466
  ] + ["grpd| " + item for item in self._distribution]
467
+ else:
468
+ self._distribution = ["trad| " + item for item in self._distribution
469
+ ]
464
470
 
465
471
  # output information
466
472
  self.convergence = None
@@ -1565,9 +1571,9 @@ class ObjectiveFunction(object):
1565
1571
  eVy = eVy.ravel()
1566
1572
 
1567
1573
 
1568
- eVy = np.nan_to_num(eVy, nan=100000, posinf=100000)
1569
- eVy = np.clip(eVy, None, 1000)
1570
- mae = np.nan_to_num(MAE(np.squeeze(y), np.squeeze(eVy)), nan=100000, posinf=100000)
1574
+ eVy = np.nan_to_num(eVy, nan=1E5, posinf=1E5)
1575
+ eVy = np.clip(eVy, None, 1E5)
1576
+ mae = np.nan_to_num(MAE(np.squeeze(y), np.squeeze(eVy)), nan=1e5, posinf=1e5)
1571
1577
 
1572
1578
  mspe = np.nan_to_num(MSPE(np.squeeze(y), np.squeeze(eVy)), nan=100000, posinf=100000)
1573
1579
  RMSE = np.sqrt(mspe)
@@ -3563,9 +3569,9 @@ class ObjectiveFunction(object):
3563
3569
  def _chol_mat(self, correlationLength, br, Br_w, correlation):
3564
3570
  # if correlation = True correlation pos is randpos, if list get correct pos
3565
3571
 
3572
+ print(self.rdm_grouped_fit, 'i think this causes the errror')
3566
3573
 
3567
-
3568
- varnames = self.none_handler(
3574
+ varnames = self.none_handler(self.grouped_rpm)+ self.none_handler(
3569
3575
  self.rdm_fit) + self.none_handler(self.rdm_cor_fit)
3570
3576
 
3571
3577
 
@@ -4791,7 +4797,7 @@ class ObjectiveFunction(object):
4791
4797
  penalty = self.custom_penalty(betas, penalty)
4792
4798
 
4793
4799
  if not np.isreal(loglik):
4794
- loglik = - 10000000.0
4800
+ loglik = - 1e5
4795
4801
 
4796
4802
  output = (-loglik + penalty,)
4797
4803
  if return_gradient:
@@ -4874,11 +4880,17 @@ class ObjectiveFunction(object):
4874
4880
  n_coeff = self.get_param_num(dispersion)
4875
4881
  Kf_a, Kr_a, Kr_c, Kr_b_a, Kchol_a, Kh = self.get_num_params()
4876
4882
  if Kchol_a != Kchol:
4877
- print('this should not hh qhy')
4883
+ print('this should not happeb but why', Kr_b, 'kr)b is')
4878
4884
 
4879
4885
  if Kr_b != Kr_a:
4880
- print('hold qhy this should never happen')
4886
+ print('self.rdm_cor_fit', self.rdm_cor_fit)
4887
+ print('grouped_fit', self.rdm_grouped_fit)
4888
+ print('self.rdm_fit', self.rdm_fit)
4889
+ print('odd, check this this should never happen')
4890
+
4891
+
4881
4892
 
4893
+ self.sanity_check(Xr, self.grouped_rpm)
4882
4894
 
4883
4895
 
4884
4896
 
@@ -4971,7 +4983,8 @@ class ObjectiveFunction(object):
4971
4983
  betas_hetro = betas[Kf + Kr + Kr_b + Kchol:Kf + Kr + Kr_b + Kchol + KFH]
4972
4984
  # betas_hetro = betas[:Xdh.shape[2]+1]
4973
4985
  betas_hetro_sd = betas[Kf + Kr + Kr_b + Kchol + KFH:Kf + Kr + Kr_b + Kchol + KFH + KFHs]
4974
- if KFHs > 1:
4986
+
4987
+ if KFHs >= 1:
4975
4988
  # print('now what how do i split')
4976
4989
  x_i_h = model_nature.get('x_h_storage_test') if test_set else model_nature.get('x_h_storage')
4977
4990
  if test_set == 2:
@@ -4992,6 +5005,7 @@ class ObjectiveFunction(object):
4992
5005
  Vdh += dev.cust_einsum("njk,nkr -> njr", i, Bh)
4993
5006
 
4994
5007
  else:
5008
+ print('this will not work cause i cant trul the right drawse')
4995
5009
  Bh = self._transform_rand_betas(betas_hetro, betas_hetro_sd, draws_hetro)
4996
5010
 
4997
5011
  Vdh = dev.cust_einsum("njk,nkr -> njr", Xdh, Bh)
@@ -7237,8 +7251,12 @@ class ObjectiveFunction(object):
7237
7251
  indices = [i for i, name in enumerate(self._characteristics_names) if name in names and isinstance(name, str)]
7238
7252
  return indices
7239
7253
 
7240
- def sanity_check(self, Xr):
7241
- a =len(self.rdm_cor_fit)+len(self.rdm_fit) != Xr.shape[2]
7254
+ def sanity_check(self, Xr, grouped_rpm = None):
7255
+ if grouped_rpm is None:
7256
+ a =len(self.rdm_cor_fit)+len(self.rdm_fit) != Xr.shape[2]
7257
+ else:
7258
+ a = len(self.none_handler(self.rdm_cor_fit)) + len(self.none_handler(self.rdm_fit)) + len(self.none_handler(grouped_rpm)) != Xr.shape[2]
7259
+
7242
7260
  if a:
7243
7261
  print('why')
7244
7262
  print('The number of random effects does not match the data')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metacountregressor
3
- Version: 0.1.316
3
+ Version: 0.1.318
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
@@ -6,15 +6,15 @@ metacountregressor/halton.py,sha256=jhovA45UBoZYU9g-hl6Lb2sBIx_ZBTNdPrpgkzR9fng,
6
6
  metacountregressor/helperprocess.py,sha256=komn_EjCShFg-_8INh1Q06GdWWN4nxhHOgJ3V1X6aJI,26309
7
7
  metacountregressor/main.py,sha256=tGOm8DdbdyDf316qIxDAre6l6GzfJIWYNYIBaSeIemI,23685
8
8
  metacountregressor/main_old.py,sha256=eTS4ygq27MnU-dZ_j983Ucb-D5XfbVF8OJQK2hVVLZc,24123
9
- metacountregressor/metaheuristics.py,sha256=Qhu06AdF8HwEpyN-Q-6deG4b4kr7BKslgL8i2T7t1aI,107234
9
+ metacountregressor/metaheuristics.py,sha256=A76VAPSbpkWTr07yiVYtFQP2dYGPzMXNDhrLWTpFvUY,107560
10
10
  metacountregressor/pareto_file.py,sha256=whySaoPAUWYjyI8zo0hwAOa3rFk6SIUlHSpqZiLur0k,23096
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=HYvf6gjH2nlrWsp0hB6lFARRzI63yt0ZsS4ATPpugUs,320919
14
+ metacountregressor/solution.py,sha256=rh_UcMSfIghkkdycDjKzmYzDyNS5wi6YmykywcC1y2Y,321846
15
15
  metacountregressor/test_generated_paper2.py,sha256=pwOoRzl1jJIIOUAAvbkT6HmmTQ81mwpsshn9SLdKOg8,3927
16
- metacountregressor-0.1.316.dist-info/licenses/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
17
- metacountregressor-0.1.316.dist-info/METADATA,sha256=yyNAZ3awOyzNk1MQFdiicSV2sjA3X4vykUdM8wBFnWE,23581
18
- metacountregressor-0.1.316.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
19
- metacountregressor-0.1.316.dist-info/top_level.txt,sha256=zGG7UC5WIpr76gsFUpwJ4En2aCcoNTONBaS3OewwjR0,19
20
- metacountregressor-0.1.316.dist-info/RECORD,,
16
+ metacountregressor-0.1.318.dist-info/licenses/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
17
+ metacountregressor-0.1.318.dist-info/METADATA,sha256=BMMooW21TLhFEHU9BOYxIa4FOvrsggrVFtfM34iWjiU,23581
18
+ metacountregressor-0.1.318.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
19
+ metacountregressor-0.1.318.dist-info/top_level.txt,sha256=zGG7UC5WIpr76gsFUpwJ4En2aCcoNTONBaS3OewwjR0,19
20
+ metacountregressor-0.1.318.dist-info/RECORD,,