metacountregressor 0.1.314__py3-none-any.whl → 0.1.316__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 +31 -9
- {metacountregressor-0.1.314.dist-info → metacountregressor-0.1.316.dist-info}/METADATA +1 -1
- {metacountregressor-0.1.314.dist-info → metacountregressor-0.1.316.dist-info}/RECORD +6 -6
- {metacountregressor-0.1.314.dist-info → metacountregressor-0.1.316.dist-info}/WHEEL +0 -0
- {metacountregressor-0.1.314.dist-info → metacountregressor-0.1.316.dist-info}/licenses/LICENSE.txt +0 -0
- {metacountregressor-0.1.314.dist-info → metacountregressor-0.1.316.dist-info}/top_level.txt +0 -0
metacountregressor/solution.py
CHANGED
@@ -1035,9 +1035,9 @@ class ObjectiveFunction(object):
|
|
1035
1035
|
|
1036
1036
|
abct = []
|
1037
1037
|
hetro_long = hetro_long + hetro_std
|
1038
|
-
for i in model_nature['
|
1038
|
+
for i in model_nature['transform_hetro']:
|
1039
1039
|
abct = abct + i
|
1040
|
-
for i in model_nature['
|
1040
|
+
for i in model_nature['transform_hetro']:
|
1041
1041
|
abct = abct + ['']
|
1042
1042
|
else:
|
1043
1043
|
big_hetro = []
|
@@ -5954,7 +5954,7 @@ class ObjectiveFunction(object):
|
|
5954
5954
|
def hessian_loglik_function(self, params, *args):
|
5955
5955
|
return self._loglik_gradient(params, *args)
|
5956
5956
|
|
5957
|
-
def _run_optimization(self, XX, y, dispersion, initial_params, bounds, tol, mod):
|
5957
|
+
def _run_optimization(self, XX, y, dispersion, initial_params, bounds, tol, mod, maxiter):
|
5958
5958
|
"""
|
5959
5959
|
Run the optimization process with draws logic and update the Solution object.
|
5960
5960
|
|
@@ -5971,19 +5971,20 @@ class ObjectiveFunction(object):
|
|
5971
5971
|
Solution object with updated objectives.
|
5972
5972
|
"""
|
5973
5973
|
# Extract relevant data
|
5974
|
-
X, Xr, XG = mod.get('X'), mod.get('Xr'), mod.get('XG')
|
5974
|
+
X, Xr, XG, XH= mod.get('X'), mod.get('Xr'), mod.get('XG'), mod.get('XH')
|
5975
5975
|
distribution = mod.get('dist_fit')
|
5976
5976
|
|
5977
5977
|
# Prepare draws
|
5978
5978
|
draws = self._prepare_draws(Xr, distribution)
|
5979
5979
|
draws_grouped = self._prepare_grouped_draws(XG, mod) if XG is not None else None
|
5980
|
-
|
5980
|
+
mod = self._prepare_hetro(mod)
|
5981
5981
|
# Optimization method and options
|
5982
5982
|
method = self.method_ll if bounds is None else 'L-BFGS-B'
|
5983
5983
|
|
5984
5984
|
|
5985
5985
|
#method = 'Nelder-Mead-BFGS'
|
5986
|
-
|
5986
|
+
|
5987
|
+
options = {'gtol': tol['gtol'], 'ftol': tol['ftol'], 'maxiter': maxiter}
|
5987
5988
|
args=(
|
5988
5989
|
X, y, draws, X, Xr, self.batch_size, self.grad_yes, self.hess_yes, dispersion, 0, False, 0,
|
5989
5990
|
self.rdm_cor_fit, None, None, draws_grouped, XG, mod
|
@@ -6329,7 +6330,7 @@ class ObjectiveFunction(object):
|
|
6329
6330
|
|
6330
6331
|
return initial_params
|
6331
6332
|
|
6332
|
-
def fitRegression(self, mod, dispersion=0, maxiter=
|
6333
|
+
def fitRegression(self, mod, dispersion=0, maxiter=20, batch_size=None, num_hess=False, **kwargs):
|
6333
6334
|
"""
|
6334
6335
|
Fits a Poisson regression, NB regression (dispersion=1), or GP regression (dispersion=2).
|
6335
6336
|
|
@@ -6367,7 +6368,7 @@ class ObjectiveFunction(object):
|
|
6367
6368
|
|
6368
6369
|
# Run optimization
|
6369
6370
|
optimization_result = self._run_optimization(
|
6370
|
-
XX, y, dispersion, initial_params, bounds, tol, mod
|
6371
|
+
XX, y, dispersion, initial_params, bounds, tol, mod, maxiter=maxiter
|
6371
6372
|
)
|
6372
6373
|
|
6373
6374
|
# Post-process results
|
@@ -6450,6 +6451,27 @@ class ObjectiveFunction(object):
|
|
6450
6451
|
return self.prepare_halton(
|
6451
6452
|
n_random_effects, n_samples, self.Ndraws, distribution, long=False, slice_this_way=self.group_halton
|
6452
6453
|
)
|
6454
|
+
|
6455
|
+
def _prepare_hetro(self, mod):
|
6456
|
+
if 'XH' in mod and len(mod.get('hetro_hold')) > 0:
|
6457
|
+
|
6458
|
+
XH = mod.get('XH')
|
6459
|
+
|
6460
|
+
styd = list(mod.get('hetro_hold').keys())
|
6461
|
+
|
6462
|
+
nh, ph, ______ = XH.shape
|
6463
|
+
kgh = len(mod.get('hetro_hold'))
|
6464
|
+
draws_hetro = self.prepare_halton(kgh, nh, self.Ndraws, styd, slice_this_way=self.group_halton)
|
6465
|
+
mod['draws_hetro'] = draws_hetro.copy()
|
6466
|
+
if self.is_multi:
|
6467
|
+
XHtest = mod.get('XH_test')
|
6468
|
+
nht, pht, ______ = XHtest.shape
|
6469
|
+
draws_hetro_test = self.prepare_halton(kgh, nht, self.Ndraws, styd,
|
6470
|
+
slice_this_way=self.group_halton_test)
|
6471
|
+
mod['draws_hetro_test'] = draws_hetro_test.copy()
|
6472
|
+
return mod
|
6473
|
+
|
6474
|
+
|
6453
6475
|
|
6454
6476
|
def _prepare_grouped_draws(self, XG, mod):
|
6455
6477
|
"""
|
@@ -7290,7 +7312,7 @@ class ObjectiveFunction(object):
|
|
7290
7312
|
X_h_test = df_test[:, :, indices_hetro]
|
7291
7313
|
x_h_storage_test.append(X_h_test)
|
7292
7314
|
model_nature['x_h_storage'] = x_h_storage
|
7293
|
-
model_nature['
|
7315
|
+
model_nature['transform_hetro'] = transform_hetro
|
7294
7316
|
model_nature['x_h_storage_test'] = x_h_storage_test
|
7295
7317
|
|
7296
7318
|
if hasattr(self, 'group_dummies'):
|
@@ -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=HYvf6gjH2nlrWsp0hB6lFARRzI63yt0ZsS4ATPpugUs,320919
|
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.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,,
|
File without changes
|
{metacountregressor-0.1.314.dist-info → metacountregressor-0.1.316.dist-info}/licenses/LICENSE.txt
RENAMED
File without changes
|
File without changes
|