metacountregressor 0.1.309__py3-none-any.whl → 0.1.311__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.
@@ -414,10 +414,12 @@ def transform_dataframe(df, config):
414
414
  data = data.apply(settings['apply_func'])
415
415
  output_df[column] = data
416
416
  elif settings['type'] == 'normalized':
417
+ if column in df.columns:
417
418
  # Normalize the column
418
- scaler = MinMaxScaler
419
- output_df[column] = scaler.fit_transform(df[[column]]).flatten()
420
-
419
+ scaler = MinMaxScaler
420
+ output_df[column] = scaler.fit_transform(df[[column]]).flatten()
421
+ else:
422
+ print(f'config variable {column} is not in the data. Ignoring ...')
421
423
  elif settings['type'] == 'none':
422
424
  # Leave the column unchanged
423
425
  if column in df.columns:
@@ -30,7 +30,7 @@ from scipy.special import gammaln
30
30
  from sklearn.metrics import mean_absolute_error as MAE
31
31
  from sklearn.metrics import mean_squared_error as MSPE
32
32
  from statsmodels.tools.numdiff import approx_fprime, approx_hess
33
- from autograd import hessian as autograd_hessian
33
+
34
34
  from sklearn.preprocessing import StandardScaler, MinMaxScaler
35
35
  from texttable import Texttable
36
36
  import time
@@ -455,7 +455,7 @@ class ObjectiveFunction(object):
455
455
  self._transformations = kwargs.get('_transformations', ["no", "log", "sqrt", "arcsinh", "nil"])
456
456
  # self._distribution = ['triangular', 'uniform', 'normal', 'ln_normal', 'tn_normal', 'lindley']
457
457
 
458
- self._distribution = kwargs.get('_distributions', ['triangular', 'uniform', 'normal', 'ln_normal', 'tn_normal'])
458
+ self._distribution = kwargs.get('_distributions', ['triangular', 'uniform', 'normal', 'tn_normal'])
459
459
 
460
460
  if self.G is not None:
461
461
  #TODO need to handle this for groups
@@ -5060,11 +5060,12 @@ class ObjectiveFunction(object):
5060
5060
  proba_ = proba_n.sum(axis =1)
5061
5061
 
5062
5062
  """""
5063
- betas_last = betas[-1]
5063
+ main_disper = self.get_dispersion_paramaters(betas, dispersion)
5064
+
5064
5065
 
5065
5066
  # print(betas_last)
5066
5067
  proba_, proba_n = self.prob_obs_draws_all_at_once(
5067
- eVd, np.atleast_3d(y), betas_last, dispersion)
5068
+ eVd, np.atleast_3d(y), main_disper, dispersion)
5068
5069
  # self._prob_product_against_panels()
5069
5070
 
5070
5071
  # print(top_stats)
@@ -5648,7 +5649,7 @@ class ObjectiveFunction(object):
5648
5649
  covariance = self.handle_covariance(covariance)
5649
5650
  covariance = np.clip(covariance, 0, None)
5650
5651
  stderr = np.sqrt(np.diag(covariance))
5651
- if stderr_opg:
5652
+ if stderr_opg is not None:
5652
5653
  stderr = np.minimum(stderr, stderr_opg)
5653
5654
 
5654
5655
 
@@ -5995,6 +5996,20 @@ class ObjectiveFunction(object):
5995
5996
  tol=tol.get('ftol', 1e-6), # Use 'ftol' as the default tolerance
5996
5997
  options=options
5997
5998
  )
5999
+ if optimization_result.message == 'NaN result encountered.':
6000
+ optimization_result = self._minimize(self._loglik_gradient,
6001
+ initial_params,
6002
+ args=(
6003
+ X, y, draws, X, Xr, self.batch_size, self.grad_yes, self.hess_yes, dispersion, 0, False, 0,
6004
+ self.rdm_cor_fit, None, None, draws_grouped, XG, mod
6005
+ ),
6006
+ method='Nelder-Mead-BFGS',
6007
+ bounds=bounds,
6008
+ tol=tol.get('ftol', 1e-4), # Use 'ftol' as the default tolerance
6009
+ options=options
6010
+ )
6011
+
6012
+
5998
6013
  if self.run_numerical_hessian:
5999
6014
  std_errors = self.bootstrap_std_dev(
6000
6015
  initial_params=optimization_result.x,
@@ -6191,7 +6206,7 @@ class ObjectiveFunction(object):
6191
6206
  else:
6192
6207
  # Optimization failed, return None for all metrics
6193
6208
  print("Optimization failed.")
6194
- return None, None, None, None, None, None, None, None
6209
+ return None, None, None, None, None, None, None, None, None
6195
6210
  def _prepare_data_and_bounds(self, mod, dispersion):
6196
6211
  """Prepare the data matrices, bounds, and initial parameters."""
6197
6212
  # Prepare data matrices
@@ -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
@@ -3,7 +3,7 @@ metacountregressor/_device_cust.py,sha256=759fnKmTYccJm4Lpi9_1reurh6OB9d6q9soPR0
3
3
  metacountregressor/app_main.py,sha256=vY3GczTbGbBRalbzMkl_9jVW7RMgEOc6z2Dr1IZJv9c,10014
4
4
  metacountregressor/data_split_helper.py,sha256=M2fIMdIO8znUaYhx5wlacRyNWdQjNYu1z1wkE-kFUYU,3373
5
5
  metacountregressor/halton.py,sha256=jhovA45UBoZYU9g-hl6Lb2sBIx_ZBTNdPrpgkzR9fng,9463
6
- metacountregressor/helperprocess.py,sha256=8PFxX3KTsWH0MlfhniDzKQOJQ63LmJ0eg6cYhQP_fRA,26162
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
9
  metacountregressor/metaheuristics.py,sha256=P0Xjlvhp1cEwZFACrqeeets6x8BK7F2iDyu1OfS4bog,107010
@@ -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=YRskJOR7MU50z22mdt5J9KLMmzHXZNXGnHRMLQPc3R0,319113
14
+ metacountregressor/solution.py,sha256=h-sHkShA-P5oWJuowCRt0J2wixcxCgoL_tlyM2NCBxQ,319693
15
15
  metacountregressor/test_generated_paper2.py,sha256=pwOoRzl1jJIIOUAAvbkT6HmmTQ81mwpsshn9SLdKOg8,3927
16
- metacountregressor-0.1.309.dist-info/licenses/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
17
- metacountregressor-0.1.309.dist-info/METADATA,sha256=vLvLKlMnboMQGkDkupIo-Uwr9gx-rdM5HuEvrt08uMs,23581
18
- metacountregressor-0.1.309.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
19
- metacountregressor-0.1.309.dist-info/top_level.txt,sha256=zGG7UC5WIpr76gsFUpwJ4En2aCcoNTONBaS3OewwjR0,19
20
- metacountregressor-0.1.309.dist-info/RECORD,,
16
+ metacountregressor-0.1.311.dist-info/licenses/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
17
+ metacountregressor-0.1.311.dist-info/METADATA,sha256=U0e8zrNVJziARj-x5z-ezThGsPGvwBwLY_mr4gVjZ5Q,23581
18
+ metacountregressor-0.1.311.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
19
+ metacountregressor-0.1.311.dist-info/top_level.txt,sha256=zGG7UC5WIpr76gsFUpwJ4En2aCcoNTONBaS3OewwjR0,19
20
+ metacountregressor-0.1.311.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.0.2)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5