metacountregressor 0.1.108__py3-none-any.whl → 0.1.116__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/app_main.py +9 -4
- metacountregressor/helperprocess.py +267 -5
- metacountregressor/main.py +172 -61
- metacountregressor/metaheuristics.py +20 -9
- metacountregressor/setup.py +3 -2
- metacountregressor/solution.py +483 -131
- {metacountregressor-0.1.108.dist-info → metacountregressor-0.1.116.dist-info}/METADATA +37 -9
- {metacountregressor-0.1.108.dist-info → metacountregressor-0.1.116.dist-info}/RECORD +11 -11
- {metacountregressor-0.1.108.dist-info → metacountregressor-0.1.116.dist-info}/WHEEL +1 -1
- {metacountregressor-0.1.108.dist-info → metacountregressor-0.1.116.dist-info}/LICENSE.txt +0 -0
- {metacountregressor-0.1.108.dist-info → metacountregressor-0.1.116.dist-info}/top_level.txt +0 -0
|
@@ -72,7 +72,7 @@ def dict_mean(dict_list,
|
|
|
72
72
|
mean_dict[key] = sum(d[key] for d in dict_list) / len(dict_list)
|
|
73
73
|
return mean_dict
|
|
74
74
|
else:
|
|
75
|
-
|
|
75
|
+
mean_dict = {}
|
|
76
76
|
for key in dict_list[0].keys():
|
|
77
77
|
if key in ignore:
|
|
78
78
|
continue
|
|
@@ -402,6 +402,7 @@ class DifferentialEvolution(object):
|
|
|
402
402
|
self._obj_fun._obj_1 = 'bic'
|
|
403
403
|
|
|
404
404
|
self._pop_size = kwargs.get('_pop_size', 20)
|
|
405
|
+
print('Population size is', self._pop_size)
|
|
405
406
|
if not isinstance(self._pop_size, int):
|
|
406
407
|
raise ValueError("_pop_size must be an integer")
|
|
407
408
|
elif self._pop_size <= 3:
|
|
@@ -618,7 +619,7 @@ class DifferentialEvolution(object):
|
|
|
618
619
|
1)
|
|
619
620
|
|
|
620
621
|
if len(self._pareto_population) == 1:
|
|
621
|
-
print('
|
|
622
|
+
print('Pareto Population Size is only 1')
|
|
622
623
|
if self.pf.check_dominance([obj_trial[self.pf.obj_key_1], obj_trial[self.pf.obj_key_2]],
|
|
623
624
|
[self._population[j][self.pf.obj_key_1], self._population[j][
|
|
624
625
|
self.pf.obj_key_2]]): # if solution dominates existing #FIXME some error here true but not entering
|
|
@@ -787,7 +788,7 @@ class SimulatedAnnealing(object):
|
|
|
787
788
|
self.accept = 0
|
|
788
789
|
self.profiler = []
|
|
789
790
|
self.update_t = self.cooling_linear_m
|
|
790
|
-
self.
|
|
791
|
+
self.get_directory()
|
|
791
792
|
self._crossover_perc = float(kwargs.get('_crossover_perc', 0.2)) or float(kwargs.get('_cr', 0.2))
|
|
792
793
|
self._obj_fun = objective_function
|
|
793
794
|
if objective_function.is_multi: # TODO Define more specific objectives in the intialiser
|
|
@@ -801,7 +802,7 @@ class SimulatedAnnealing(object):
|
|
|
801
802
|
self.pf = Pareto(self.obj_1, self.obj_2, False)
|
|
802
803
|
self._sa_memory = list()
|
|
803
804
|
|
|
804
|
-
def
|
|
805
|
+
def get_directory(self):
|
|
805
806
|
# checking if the directory demo_folder2
|
|
806
807
|
# exist or not.
|
|
807
808
|
if not os.path.isdir(self.instance_number):
|
|
@@ -1004,7 +1005,7 @@ class SimulatedAnnealing(object):
|
|
|
1004
1005
|
elif num_of_changeablePARMs == 0:
|
|
1005
1006
|
rdm_i = random.choice(range(len(prmVect)))
|
|
1006
1007
|
if self._obj_fun.get_num_discrete_values(rdm_i) <= 1:
|
|
1007
|
-
print('
|
|
1008
|
+
print('retry')
|
|
1008
1009
|
|
|
1009
1010
|
while self._obj_fun.get_num_discrete_values(rdm_i) <= 1:
|
|
1010
1011
|
rdm_i = random.randint(0, self._obj_fun.get_num_parameters() - 1)
|
|
@@ -1046,7 +1047,7 @@ class SimulatedAnnealing(object):
|
|
|
1046
1047
|
get_rdm_j = random.randint(0, self._obj_fun.get_num_discrete_values(rdm_i) - 1)
|
|
1047
1048
|
if (self._obj_fun.get_num_discrete_values(
|
|
1048
1049
|
rdm_i) - 1) < 1: # TODO: remove this is just a test
|
|
1049
|
-
|
|
1050
|
+
|
|
1050
1051
|
break
|
|
1051
1052
|
new_nbr_i = self._obj_fun.get_value(rdm_i, get_rdm_j)
|
|
1052
1053
|
neighbour[rdm_i] = new_nbr_i
|
|
@@ -1237,15 +1238,25 @@ class HarmonySearch(object):
|
|
|
1237
1238
|
Initialize HS with the specified objective function. Note that this objective function must implement ObjectiveFunctionInterface.
|
|
1238
1239
|
"""
|
|
1239
1240
|
self._obj_fun = objective_function
|
|
1241
|
+
## NEW CODE, TRYING TO EXCTACT OUT THE PARAMATERS
|
|
1242
|
+
self._hms = kwargs.get('_hms', 20)
|
|
1243
|
+
self._par = kwargs.get('_par', .30)
|
|
1244
|
+
self.F = kwargs.get('_AI', 2) # mutation scale
|
|
1245
|
+
self.iter = kwargs.get('_max_iter', 10000)
|
|
1246
|
+
self.cr = kwargs.get('_crossover_perc') or kwargs.get('_cr', 0.2)
|
|
1247
|
+
self.instance_number = str(kwargs.get('instance_number', 1))
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
|
|
1240
1251
|
# for printing basics metrics
|
|
1241
|
-
self.print_verbose =
|
|
1252
|
+
self.print_verbose = kwargs.get('verbose', False)
|
|
1242
1253
|
# harmony_memory stores the best hms harmonies
|
|
1243
1254
|
self._harmony_memory = list()
|
|
1244
1255
|
# harmony_history stores all hms harmonies every nth improvisations (i.e., one 'generation')
|
|
1245
1256
|
self._harmony_history = list()
|
|
1246
1257
|
# saves the best fitness
|
|
1247
1258
|
self.instance_number = str(objective_function.instance_number)
|
|
1248
|
-
self.
|
|
1259
|
+
self.get_directory()
|
|
1249
1260
|
self._harmony_trace_best = list()
|
|
1250
1261
|
self._harmony_trace_incumbent = list()
|
|
1251
1262
|
if self._obj_fun.is_multi: # TODO Define more specific objectives in the intialiser
|
|
@@ -1261,7 +1272,7 @@ class HarmonySearch(object):
|
|
|
1261
1272
|
|
|
1262
1273
|
self.pf = Pareto(self.obj_1, self.obj_2, False)
|
|
1263
1274
|
|
|
1264
|
-
def
|
|
1275
|
+
def get_directory(self):
|
|
1265
1276
|
# checking if the directory demo_folder2
|
|
1266
1277
|
# exist or not.
|
|
1267
1278
|
if not os.path.isdir(self.instance_number):
|
metacountregressor/setup.py
CHANGED
|
@@ -8,7 +8,7 @@ with codecs.open("README.rst", encoding='utf8') as fh:
|
|
|
8
8
|
setuptools.setup(name='metacountregressor',
|
|
9
9
|
version='0.1.63',
|
|
10
10
|
description='Extensions for a Python package for \
|
|
11
|
-
|
|
11
|
+
estimation of data count models.',
|
|
12
12
|
long_description=long_description,
|
|
13
13
|
long_description_content_type="text/x-rst",
|
|
14
14
|
url='https://github.com/zahern/CountDataEstimation',
|
|
@@ -20,5 +20,6 @@ setuptools.setup(name='metacountregressor',
|
|
|
20
20
|
python_requires='>=3.10',
|
|
21
21
|
install_requires=[
|
|
22
22
|
'numpy>=1.13.1',
|
|
23
|
-
'scipy>=1.0.0'
|
|
23
|
+
'scipy>=1.0.0',
|
|
24
|
+
'latextable'
|
|
24
25
|
])
|