metacountregressor 0.1.241__py3-none-any.whl → 0.1.304__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 +2 -0
- metacountregressor/solution.py +15 -3
- {metacountregressor-0.1.241.dist-info → metacountregressor-0.1.304.dist-info}/METADATA +4 -2
- {metacountregressor-0.1.241.dist-info → metacountregressor-0.1.304.dist-info}/RECORD +8 -8
- {metacountregressor-0.1.241.dist-info → metacountregressor-0.1.304.dist-info}/WHEEL +1 -1
- {metacountregressor-0.1.241.dist-info → metacountregressor-0.1.304.dist-info/licenses}/LICENSE.txt +0 -0
- {metacountregressor-0.1.241.dist-info → metacountregressor-0.1.304.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,
|
metacountregressor/solution.py
CHANGED
@@ -451,7 +451,7 @@ class ObjectiveFunction(object):
|
|
451
451
|
# define the variables
|
452
452
|
|
453
453
|
|
454
|
-
self._transformations = kwargs.get('_transformations', ["no", "log", "sqrt", "arcsinh"])
|
454
|
+
self._transformations = kwargs.get('_transformations', ["no", "log", "sqrt", "arcsinh", "nil"])
|
455
455
|
# self._distribution = ['triangular', 'uniform', 'normal', 'ln_normal', 'tn_normal', 'lindley']
|
456
456
|
|
457
457
|
self._distribution = kwargs.get('_distributions', ['triangular', 'uniform', 'normal', 'ln_normal', 'tn_normal'])
|
@@ -1576,7 +1576,12 @@ class ObjectiveFunction(object):
|
|
1576
1576
|
fixed_vars, random_vars, random_var_cor) # TODO handle distrubution
|
1577
1577
|
|
1578
1578
|
distributions = alpha_rdm.copy()
|
1579
|
-
|
1579
|
+
if self.linear_regression:
|
1580
|
+
|
1581
|
+
transformations = ['nil'] * len(alpha) # todo add transformations
|
1582
|
+
else:
|
1583
|
+
transformations = ['no'] * len(alpha) # todo add transformations
|
1584
|
+
|
1580
1585
|
cnt = 0
|
1581
1586
|
joined_alpha = np.add(alpha_rdm, alpha_rdm_cor)
|
1582
1587
|
for i, x in enumerate(joined_alpha):
|
@@ -3983,7 +3988,7 @@ class ObjectiveFunction(object):
|
|
3983
3988
|
|
3984
3989
|
|
3985
3990
|
if linear:
|
3986
|
-
eta = eta.astype('float')
|
3991
|
+
eta = eta.astype('float')
|
3987
3992
|
return eta
|
3988
3993
|
|
3989
3994
|
|
@@ -4742,9 +4747,16 @@ class ObjectiveFunction(object):
|
|
4742
4747
|
if self.is_dispersion(dispersion):
|
4743
4748
|
penalty, main_disper = self._penalty_dispersion(dispersion, main_disper, eVd, y, penalty,
|
4744
4749
|
model_nature)
|
4750
|
+
b_pen = self.custom_betas_to_penalise(betas, dispersion)
|
4751
|
+
penalty = self.regularise_l2(betas) + self.regularise_l1(betas)
|
4752
|
+
penalty = self.custom_penalty(betas, penalty)
|
4745
4753
|
|
4746
4754
|
betas[-1] = main_disper
|
4747
4755
|
|
4756
|
+
b_pen = self.custom_betas_to_penalise(betas, dispersion)
|
4757
|
+
penalty = self.regularise_l2(betas) + self.regularise_l1(betas)
|
4758
|
+
penalty = self.custom_penalty(betas, penalty)
|
4759
|
+
|
4748
4760
|
if self.linear_regression:
|
4749
4761
|
# LINEAR MODEL PROCESS
|
4750
4762
|
mse = self._linear_logliklihood(y, eVd, main_disper)
|
@@ -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.304
|
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=bDyK5K4SFboWjaUIDlBR0H04a64XabXO_74SX0q_nsk,106813
|
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=j1jzIKn74LNvxjGyVJn9CUrUpvugM6I2duGRXTCOA3A,317500
|
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.304.dist-info/licenses/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
17
|
+
metacountregressor-0.1.304.dist-info/METADATA,sha256=-Yn7gguicyi13SlwYXvUjrcC0gJPBw320AtbAjtk27M,23581
|
18
|
+
metacountregressor-0.1.304.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
19
|
+
metacountregressor-0.1.304.dist-info/top_level.txt,sha256=zGG7UC5WIpr76gsFUpwJ4En2aCcoNTONBaS3OewwjR0,19
|
20
|
+
metacountregressor-0.1.304.dist-info/RECORD,,
|
{metacountregressor-0.1.241.dist-info → metacountregressor-0.1.304.dist-info/licenses}/LICENSE.txt
RENAMED
File without changes
|
File without changes
|