metacountregressor 0.1.309__tar.gz → 0.1.311__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 (31) hide show
  1. {metacountregressor-0.1.309/metacountregressor.egg-info → metacountregressor-0.1.311}/PKG-INFO +1 -1
  2. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor/metaheuristics.py +10 -4
  3. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor/solution.py +55 -36
  4. {metacountregressor-0.1.309 → metacountregressor-0.1.311/metacountregressor.egg-info}/PKG-INFO +1 -1
  5. metacountregressor-0.1.311/version.txt +1 -0
  6. metacountregressor-0.1.309/version.txt +0 -1
  7. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/LICENSE.txt +0 -0
  8. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/MANIFEST.in +0 -0
  9. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/README.md +0 -0
  10. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/README.rst +0 -0
  11. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor/__init__.py +0 -0
  12. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor/_device_cust.py +0 -0
  13. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor/app_main.py +0 -0
  14. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor/data_split_helper.py +0 -0
  15. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor/halton.py +0 -0
  16. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor/helperprocess.py +0 -0
  17. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor/main.py +0 -0
  18. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor/main_old.py +0 -0
  19. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor/pareto_file.py +0 -0
  20. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor/pareto_logger__plot.py +0 -0
  21. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor/setup.py +0 -0
  22. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor/single_objective_finder.py +0 -0
  23. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor/test_generated_paper2.py +0 -0
  24. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor.egg-info/SOURCES.txt +0 -0
  25. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor.egg-info/dependency_links.txt +0 -0
  26. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor.egg-info/not-zip-safe +0 -0
  27. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor.egg-info/requires.txt +0 -0
  28. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/metacountregressor.egg-info/top_level.txt +0 -0
  29. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/setup.cfg +0 -0
  30. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/setup.py +0 -0
  31. {metacountregressor-0.1.309 → metacountregressor-0.1.311}/tests/test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metacountregressor
3
- Version: 0.1.309
3
+ Version: 0.1.311
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
@@ -615,10 +615,16 @@ class DifferentialEvolution(object):
615
615
  obj_trial = self._obj_fun.get_fitness(trial, self.pf.get_objective_is_multi())
616
616
  if not self.pf.get_objective_is_multi():
617
617
  average_iteration += obj_trial[self._obj_fun._obj_1]
618
- logger(i, obj_trial, None, True, self.get_instance_name(), 1)
619
- else:
620
- logger(i, obj_trial, None, True, self.get_instance_name(), self.pf.get_objective_is_multi())
618
+ try:
621
619
 
620
+ logger(i, obj_trial, None, True, self.get_instance_name(), 1)
621
+ except:
622
+ pass
623
+ else:
624
+ try:
625
+ logger(i, obj_trial, None, True, self.get_instance_name(), self.pf.get_objective_is_multi())
626
+ except:
627
+ pass
622
628
  except Exception as e:
623
629
  print('why is there an exception')
624
630
  print(e)
@@ -637,7 +643,7 @@ class DifferentialEvolution(object):
637
643
 
638
644
  iterations_without_improvement = 0
639
645
  self._population[j] = obj_trial
640
-
646
+
641
647
  logger(self.it_process, obj_trial, self._population, True,
642
648
  self.instance_number + '/population_logger_strict_non_pareto.csv', 1)
643
649
  logger(self.it_process, obj_trial, self._pareto_population, True,
@@ -3549,37 +3549,30 @@ class ObjectiveFunction(object):
3549
3549
 
3550
3550
  return inv_hess
3551
3551
 
3552
+ def _correlated_pos(self, correlation, varnames):
3553
+ if (isinstance(correlation, list)):
3554
+ correlationpos = [varnames.tolist().index(x) for x in
3555
+ varnames if x in correlation]
3556
+ uncorrelatedpos = [varnames.tolist().index(x) for x in
3557
+ varnames if x not in correlation]
3558
+ return
3559
+
3560
+
3561
+
3562
+
3552
3563
  def _chol_mat(self, correlationLength, br, Br_w, correlation):
3553
3564
  # if correlation = True correlation pos is randpos, if list get correct pos
3554
- dont_run = 0
3555
- if dont_run:
3556
- correlationpos = []
3557
- varnames = ['a', 'b', 'c', 'd', 'e', 'f']
3558
- varnames = np.asarray(varnames)
3559
- randvars = ['c', 'd', 'e', 'f']
3560
- correlation = ['e', 'f']
3561
- if randvars:
3562
- # Position of correlated variables within randvars
3563
- correlationpos = [varnames.tolist().index(x)
3564
- for x in varnames if x in randvars]
3565
- if (isinstance(correlation, list)):
3566
- self.correlationpos = [varnames.tolist().index(x) for x in
3567
- varnames if x in correlation]
3568
- self.uncorrelatedpos = [varnames.tolist().index(x) for x in
3569
- varnames if x not in correlation]
3570
- # if correlation = True correlation pos is randpos, if list get correct pos
3571
- correlationpos = []
3572
- else:
3573
- varnames = self.none_handler(
3565
+
3566
+
3567
+
3568
+ varnames = self.none_handler(
3574
3569
  self.rdm_fit) + self.none_handler(self.rdm_cor_fit)
3575
3570
 
3576
- if (isinstance(correlation, list)):
3571
+
3577
3572
  # Kchol, permutations of specified params in correlation list
3578
- Kchol = int((len(correlation) *
3573
+ Kchol = int((len(correlation) *
3579
3574
  (len(correlation) + 1)) / 2)
3580
- else:
3581
- # i.e. correlation = True, Kchol permutations of random paramaters
3582
- Kchol = int((len(br) * (len(br) + 1)) / 2)
3575
+
3583
3576
 
3584
3577
  # creating cholesky matrix for the variance-covariance matrix
3585
3578
  # all random variables not included in correlation will only
@@ -3608,7 +3601,18 @@ class ObjectiveFunction(object):
3608
3601
  is_correlated = True
3609
3602
  else:
3610
3603
  is_correlated = False
3611
- rv_val = chol[chol_count] if is_correlated else br_w[rv_count]
3604
+ try:
3605
+ rv_val = chol[chol_count] if is_correlated else br_w[rv_count]
3606
+ except:
3607
+ print('exception here start')
3608
+ print(self.rdm_cor_fit, 'rdm_cor_fit')
3609
+ print(self.rdm_fit, 'rdm_fit')
3610
+ print('varnames', varnames)
3611
+ print('br', br, 'br')
3612
+ print(Br_w, 'Br_w')
3613
+ print(chol, 'chol')
3614
+ print(br_w, 'br_w')
3615
+ print('exception here end')
3612
3616
  chol_mat_temp[rv_count_all, rv_count_all] = rv_val
3613
3617
  rv_count_all += 1
3614
3618
  if is_correlated:
@@ -4870,10 +4874,10 @@ class ObjectiveFunction(object):
4870
4874
  n_coeff = self.get_param_num(dispersion)
4871
4875
  Kf_a, Kr_a, Kr_c, Kr_b_a, Kchol_a, Kh = self.get_num_params()
4872
4876
  if Kchol_a != Kchol:
4873
- print('hold qhy')
4877
+ print('this should not hh qhy')
4874
4878
 
4875
- if Kr_b != Kr_b_a:
4876
- print('hold qhy')
4879
+ if Kr_b != Kr_a:
4880
+ print('hold qhy this should never happen')
4877
4881
 
4878
4882
 
4879
4883
 
@@ -4887,13 +4891,14 @@ class ObjectiveFunction(object):
4887
4891
 
4888
4892
  )
4889
4893
  Bf = betas[0:Kf] # Fixed betas
4890
-
4891
-
4892
- # Bf_new, Br_new, Br_std_new, Br_rema = self.extract_parameters(betas, Kf, Kr, Kchol_a, Kr_b_a)
4894
+ TEST_ME = False
4895
+ if not TEST_ME:
4896
+ Bf, br, br_std, Br_rema = self.extract_parameters(betas, Kf, Kr, Kchol_a, Kr_b_a)
4893
4897
 
4894
4898
 
4895
4899
  Vdf = dev.np.einsum('njk,k -> nj', Xdf, Bf, dtype=np.float64) # (N, P)
4896
- br = betas[Kf:Kf + Kr]
4900
+ if TEST_ME:
4901
+ br = betas[Kf:Kf + Kr]
4897
4902
 
4898
4903
 
4899
4904
 
@@ -4911,9 +4916,9 @@ class ObjectiveFunction(object):
4911
4916
  # Kchol_a + Krb_a
4912
4917
  #its grabbing from the
4913
4918
 
4919
+ if TEST_ME:
4914
4920
 
4915
-
4916
- brstd = betas[Kf + Kr:Kf + Kr + Kr_b + Kchol]
4921
+ brstd = betas[Kf + Kr:Kf + Kr + Kr_b + Kchol]
4917
4922
 
4918
4923
  # initialises size matrix
4919
4924
  proba = [] # Temp batching storage
@@ -7210,6 +7215,20 @@ class ObjectiveFunction(object):
7210
7215
  indices = [i for i, name in enumerate(self._characteristics_names) if name in names and isinstance(name, str)]
7211
7216
  return indices
7212
7217
 
7218
+ def sanity_check(self, Xr):
7219
+ a =len(self.rdm_cor_fit)+len(self.rdm_fit) != Xr.shape[2]
7220
+ if a:
7221
+ print('why')
7222
+ print('The number of random effects does not match the data')
7223
+ print(Xr.shape)
7224
+ print(self.rdm_cor_fit)
7225
+ print(self.rdm_fit)
7226
+
7227
+ #raise Exception('The number of random effects does not match the data')
7228
+ else:
7229
+ return True
7230
+
7231
+
7213
7232
  """
7214
7233
  This function is named 'makeRegression'. It takes several parameters; 'self', 'model_nature', 'layout', '*args', and '**kwargs'.
7215
7234
  The purpose of this function is to execute a regression based on the training and testing datasets.
@@ -7316,7 +7335,7 @@ class ObjectiveFunction(object):
7316
7335
  Xr_cor = df_tf[:, :, indices3]
7317
7336
  # FIXME not sure if this is the right way orientatied
7318
7337
  Xr = np.concatenate((Xr, Xr_cor), axis=2)
7319
-
7338
+ self.sanity_check(Xr)
7320
7339
  model_nature['Xr'] = Xr
7321
7340
  if self.is_multi:
7322
7341
  Xr_test = df_test[:, :, indices2]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metacountregressor
3
- Version: 0.1.309
3
+ Version: 0.1.311
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
@@ -0,0 +1 @@
1
+ 0.1.311
@@ -1 +0,0 @@
1
- 0.1.309