metacountregressor 0.1.243__py3-none-any.whl → 0.1.305__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/helperprocess.py +37 -0
- metacountregressor/metaheuristics.py +5 -1
- metacountregressor/solution.py +10 -4
- {metacountregressor-0.1.243.dist-info → metacountregressor-0.1.305.dist-info}/METADATA +4 -2
- {metacountregressor-0.1.243.dist-info → metacountregressor-0.1.305.dist-info}/RECORD +8 -8
- {metacountregressor-0.1.243.dist-info → metacountregressor-0.1.305.dist-info}/WHEEL +1 -1
- {metacountregressor-0.1.243.dist-info → metacountregressor-0.1.305.dist-info/licenses}/LICENSE.txt +0 -0
- {metacountregressor-0.1.243.dist-info → metacountregressor-0.1.305.dist-info}/top_level.txt +0 -0
@@ -539,6 +539,37 @@ def check_list_type(lst, check_type):
|
|
539
539
|
raise TypeError(f"All elements in the list must be of type {check_type}")
|
540
540
|
|
541
541
|
|
542
|
+
def plot_fitness_progress(iterations, iteration_fitnesses, best_fitnesses, average_fitness):
|
543
|
+
"""
|
544
|
+
Plots the fitness values over iterations.
|
545
|
+
|
546
|
+
Args:
|
547
|
+
iterations (list): List of iteration numbers.
|
548
|
+
iteration_fitnesses (list): List of fitness values for each iteration.
|
549
|
+
best_fitnesses (list): List of best fitness values across iterations.
|
550
|
+
average_fitness (list): List of average fitness values across iterations.
|
551
|
+
"""
|
552
|
+
plt.figure(figsize=(10, 6))
|
553
|
+
|
554
|
+
# Plot iteration fitnesses
|
555
|
+
plt.plot(iterations, iteration_fitnesses, label='Iteration Fitnesses', marker='o', color='blue')
|
556
|
+
# Plot best fitnesses
|
557
|
+
plt.plot(iterations, best_fitnesses, label='Best Fitnesses', marker='s', color='green')
|
558
|
+
# Plot average fitness
|
559
|
+
plt.plot(iterations, average_fitness, label='Average Fitness', marker='d', color='orange')
|
560
|
+
|
561
|
+
# Add labels and title
|
562
|
+
plt.xlabel('Iteration')
|
563
|
+
plt.ylabel('Fitness')
|
564
|
+
plt.title('Fitness Progression Over Iterations')
|
565
|
+
plt.legend()
|
566
|
+
plt.grid(True)
|
567
|
+
|
568
|
+
# Show the plot
|
569
|
+
plt.show()
|
570
|
+
|
571
|
+
|
572
|
+
|
542
573
|
def results_printer(results, algorithm='hs', is_multi=1, obj_1='bic', obj_2='MSE'):
|
543
574
|
if algorithm == 'hs':
|
544
575
|
plt.scatter([x['bic'] for x in results.harmony_memories], [x['MAE'] for x in results.harmony_memories])
|
@@ -565,6 +596,12 @@ def results_printer(results, algorithm='hs', is_multi=1, obj_1='bic', obj_2='MSE
|
|
565
596
|
results.iteration, results.iter_solution, results.best_solutions, results.best_fitness,
|
566
597
|
# type: ignore
|
567
598
|
results.best_struct, results.average_best)) # type: ignore
|
599
|
+
plot_fitness_progress(
|
600
|
+
iterations=results.iteration, # Replace with actual iteration numbers
|
601
|
+
iteration_fitnesses=results.iter_solution, # Replace with actual iteration fitnesses
|
602
|
+
best_fitnesses=results.best_solutions, # Replace with the best fitnesses
|
603
|
+
average_fitness=results.average_best # Replace with average fitnesses
|
604
|
+
)
|
568
605
|
elif algorithm == 'sa':
|
569
606
|
print(
|
570
607
|
'Elapsed time: {}\nIterations: {}'.format(
|
@@ -240,7 +240,9 @@ def differential_evolution(objective_function, initial_slns=None, **kwargs):
|
|
240
240
|
initial_slns=initial_slns, mod_init=man)
|
241
241
|
AVERAGE_BEST = st.mean(best_solutions)
|
242
242
|
end = datetime.now()
|
243
|
+
|
243
244
|
elapsed_time = end - start
|
245
|
+
print(f'elapsed time{elapsed_time}')
|
244
246
|
return DifferentialEvolutionResults(elapsed_time=elapsed_time, iteration=iterations,
|
245
247
|
iter_solution=solutions, best_solutions=best_solutions,
|
246
248
|
best_fitness=best_fitness,
|
@@ -403,6 +405,7 @@ class DifferentialEvolution(object):
|
|
403
405
|
"""
|
404
406
|
|
405
407
|
def __init__(self, objective_function, **kwargs):
|
408
|
+
objective_function.algorithm = 'de'
|
406
409
|
self._obj_fun = objective_function
|
407
410
|
if self._obj_fun._obj_1 is None:
|
408
411
|
print('no objective found, automatically selecting BIC')
|
@@ -778,7 +781,7 @@ class SimulatedAnnealing(object):
|
|
778
781
|
"""
|
779
782
|
|
780
783
|
def __init__(self, objective_function, **kwargs):
|
781
|
-
|
784
|
+
objective_function.algorithm = 'sa'
|
782
785
|
self._STEPS_PER_TEMP = int(kwargs.get('STEPS_PER_TEMP', 2)) or int(kwargs.get('_ts', 2))
|
783
786
|
self._INITAL_ACCEPT_RATE = float(kwargs.get('INTL_ACPT', 0.5))
|
784
787
|
self._NUM_INITIAL_SLNS = int(kwargs.get('_num_intl_slns', 20))
|
@@ -1245,6 +1248,7 @@ class HarmonySearch(object):
|
|
1245
1248
|
"""
|
1246
1249
|
Initialize HS with the specified objective function. Note that this objective function must implement ObjectiveFunctionInterface.
|
1247
1250
|
"""
|
1251
|
+
objective_function.algorithm = 'hs'
|
1248
1252
|
self._obj_fun = objective_function
|
1249
1253
|
## NEW CODE, TRYING TO EXCTACT OUT THE PARAMATERS
|
1250
1254
|
self._hms = kwargs.get('_hms', 20)
|
metacountregressor/solution.py
CHANGED
@@ -125,7 +125,7 @@ class ObjectiveFunction(object):
|
|
125
125
|
self.gbl_best = 1000000.0
|
126
126
|
self.run_bootstrap = kwargs.get('run_bootstrap', False)
|
127
127
|
self.linear_regression = kwargs.get('linear_model', False)
|
128
|
-
self.reg_penalty = 1
|
128
|
+
self.reg_penalty = kwargs.get('reg_penalty',1)
|
129
129
|
self.power_up_ll = False
|
130
130
|
self.nb_parma = 1
|
131
131
|
self.bic = None
|
@@ -176,7 +176,6 @@ class ObjectiveFunction(object):
|
|
176
176
|
self._max_imp = kwargs.get('_max_imp', 90000000)
|
177
177
|
self._WIC = kwargs.get("WIC",10000) # Number of Iterations without Multiobjective Improvement #tod chuck into solution
|
178
178
|
self._panels = None
|
179
|
-
self.is_multi = True
|
180
179
|
self.method_ll = 'Nelder-Mead-BFGS'
|
181
180
|
|
182
181
|
self.method_ll = 'L-BFGS-B' # alternatives 'BFGS_2', 'BFGS
|
@@ -3988,7 +3987,7 @@ class ObjectiveFunction(object):
|
|
3988
3987
|
|
3989
3988
|
|
3990
3989
|
if linear:
|
3991
|
-
eta = eta.astype('float')
|
3990
|
+
eta = eta.astype('float')
|
3992
3991
|
return eta
|
3993
3992
|
|
3994
3993
|
|
@@ -4747,9 +4746,16 @@ class ObjectiveFunction(object):
|
|
4747
4746
|
if self.is_dispersion(dispersion):
|
4748
4747
|
penalty, main_disper = self._penalty_dispersion(dispersion, main_disper, eVd, y, penalty,
|
4749
4748
|
model_nature)
|
4749
|
+
b_pen = self.custom_betas_to_penalise(betas, dispersion)
|
4750
|
+
penalty = self.regularise_l2(betas) + self.regularise_l1(betas)
|
4751
|
+
penalty = self.custom_penalty(betas, penalty)
|
4750
4752
|
|
4751
4753
|
betas[-1] = main_disper
|
4752
4754
|
|
4755
|
+
b_pen = self.custom_betas_to_penalise(betas, dispersion)
|
4756
|
+
penalty = self.regularise_l2(betas) + self.regularise_l1(betas)
|
4757
|
+
penalty = self.custom_penalty(betas, penalty)
|
4758
|
+
|
4753
4759
|
if self.linear_regression:
|
4754
4760
|
# LINEAR MODEL PROCESS
|
4755
4761
|
mse = self._linear_logliklihood(y, eVd, main_disper)
|
@@ -5929,7 +5935,7 @@ class ObjectiveFunction(object):
|
|
5929
5935
|
|
5930
5936
|
# Optimization method and options
|
5931
5937
|
method = self.method_ll if bounds is None else 'L-BFGS-B'
|
5932
|
-
|
5938
|
+
|
5933
5939
|
|
5934
5940
|
#method = 'Nelder-Mead-BFGS'
|
5935
5941
|
options = {'gtol': tol['gtol'], 'ftol': tol['ftol'], 'maxiter': 4000}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: metacountregressor
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.305
|
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
|
@@ -17,12 +17,14 @@ Requires-Dist: pandas
|
|
17
17
|
Requires-Dist: scikit-learn>=1.3.1
|
18
18
|
Requires-Dist: statsmodels
|
19
19
|
Requires-Dist: psutil
|
20
|
+
Requires-Dist: pybind11>=2.12
|
20
21
|
Dynamic: author
|
21
22
|
Dynamic: author-email
|
22
23
|
Dynamic: description
|
23
24
|
Dynamic: description-content-type
|
24
25
|
Dynamic: home-page
|
25
26
|
Dynamic: license
|
27
|
+
Dynamic: license-file
|
26
28
|
Dynamic: requires-dist
|
27
29
|
Dynamic: requires-python
|
28
30
|
Dynamic: summary
|
@@ -3,18 +3,18 @@ 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=
|
6
|
+
metacountregressor/helperprocess.py,sha256=ufdB6BcCIYN6btWdxyFlRCReuYEbVh6es1sdLsd8RTg,25917
|
7
7
|
metacountregressor/main.py,sha256=xfpKN2w0kePHp_Q2HOPjtG15PLEN1L3sEnDw1PHBquw,23668
|
8
8
|
metacountregressor/main_old.py,sha256=eTS4ygq27MnU-dZ_j983Ucb-D5XfbVF8OJQK2hVVLZc,24123
|
9
|
-
metacountregressor/metaheuristics.py,sha256=
|
9
|
+
metacountregressor/metaheuristics.py,sha256=eVlP9FO8StVxj7D6m8n6ekRR45sOtjZuoakr5tzb-H4,106944
|
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=
|
14
|
+
metacountregressor/solution.py,sha256=iRQDiIoLYs1NbWzzmYmL4OdfYGwOyurzc3nFYmWZ6EI,317471
|
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.305.dist-info/licenses/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
17
|
+
metacountregressor-0.1.305.dist-info/METADATA,sha256=sBsdECU898Hl9-UWO1XbA9CABw4QV45mit4eoqZJt-o,23581
|
18
|
+
metacountregressor-0.1.305.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
19
|
+
metacountregressor-0.1.305.dist-info/top_level.txt,sha256=zGG7UC5WIpr76gsFUpwJ4En2aCcoNTONBaS3OewwjR0,19
|
20
|
+
metacountregressor-0.1.305.dist-info/RECORD,,
|
{metacountregressor-0.1.243.dist-info → metacountregressor-0.1.305.dist-info/licenses}/LICENSE.txt
RENAMED
File without changes
|
File without changes
|