metacountregressor 1.0.5__tar.gz → 1.0.6__tar.gz
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-1.0.5/metacountregressor.egg-info → metacountregressor-1.0.6}/PKG-INFO +11 -14
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/README.md +10 -13
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/README.rst +10 -13
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/metaheuristics.py +32 -32
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/solution.py +8 -8
- {metacountregressor-1.0.5 → metacountregressor-1.0.6/metacountregressor.egg-info}/PKG-INFO +11 -14
- metacountregressor-1.0.6/version.txt +1 -0
- metacountregressor-1.0.5/version.txt +0 -1
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/LICENSE.txt +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/MANIFEST.in +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/__init__.py +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/_device_cust.py +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/app_main.py +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/data_split_helper.py +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/halton.py +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/helperprocess.py +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/main.py +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/main_old.py +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/pareto_file.py +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/pareto_logger__plot.py +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/setup.py +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/single_objective_finder.py +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/test_code.py +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/test_generated_paper2.py +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor.egg-info/SOURCES.txt +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor.egg-info/dependency_links.txt +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor.egg-info/not-zip-safe +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor.egg-info/requires.txt +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor.egg-info/top_level.txt +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/setup.cfg +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/setup.py +0 -0
- {metacountregressor-1.0.5 → metacountregressor-1.0.6}/tests/test.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: metacountregressor
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.6
|
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
|
@@ -95,7 +95,7 @@ X['Offset'] = np.log(df['AADT']) # Explicitley define how to offset the data, no
|
|
95
95
|
X = df.drop(columns=['FREQ', 'ID', 'AADT'])
|
96
96
|
|
97
97
|
#some example argument, these are defualt so the following line is just for claritity. See the later agruments section for detials.
|
98
|
-
arguments = {'algorithm': 'hs', 'test_percentage': 0.15, 'test_complexity': 6, '
|
98
|
+
arguments = {'algorithm': 'hs', 'test_percentage': 0.15, 'test_complexity': 6, 'instance_name':1,
|
99
99
|
'val_percentage':0.15, 'obj_1': 'bic', '_obj_2': 'RMSE_TEST', "_max_time": 6}
|
100
100
|
# Fit the model with metacountregressor
|
101
101
|
obj_fun = ObjectiveFunction(X, y, **arguments)
|
@@ -135,9 +135,9 @@ arguments = {
|
|
135
135
|
'test_percentage': 0.2, # used in multi-objective optimisation only. Saves 20% of data for testing.
|
136
136
|
'val_percenetage:': 0.2, # Saves 20% of data for testing.
|
137
137
|
'test_complexity': 6, # Complexity level for testing (6 tests all) or a list to consider potential differences in complexity
|
138
|
-
'
|
138
|
+
'instance_name': 'name', # used for creeting a named folder where your models are saved into from the directory
|
139
139
|
'distribution': ['Normal', 'LnNormal', 'Triangular', 'Uniform'],
|
140
|
-
'
|
140
|
+
'model_types': [[0,1]], # or equivalently ['POS', 'NB']
|
141
141
|
'transformations': ['no', 'sqrt', 'archsinh'],
|
142
142
|
'method_ll': 'BFGS_2',
|
143
143
|
'_max_time': 10
|
@@ -156,7 +156,7 @@ manual_fit_spec = {
|
|
156
156
|
'fixed_terms': ['SINGLE', 'LENGTH'],
|
157
157
|
'rdm_terms': ['AADT:normal'],
|
158
158
|
'rdm_cor_terms': ['GRADEBR:normal', 'CURVES:normal'],
|
159
|
-
'
|
159
|
+
'grouped_rdm': [],
|
160
160
|
'hetro_in_means': ['ACCESS:normal', 'MINRAD:normal'],
|
161
161
|
'transformations': ['no', 'no', 'log', 'no', 'no', 'no', 'no'],
|
162
162
|
'dispersion': 0
|
@@ -168,7 +168,7 @@ arguments = {
|
|
168
168
|
'algorithm': 'hs',
|
169
169
|
'test_percentage': 0.2,
|
170
170
|
'test_complexity': 6,
|
171
|
-
'
|
171
|
+
'instance_name': 'name',
|
172
172
|
'Manual_Fit': manual_fit_spec
|
173
173
|
}
|
174
174
|
obj_fun = ObjectiveFunction(X, y, **arguments)
|
@@ -268,25 +268,22 @@ The following list describes the arguments available in this function. By defaul
|
|
268
268
|
|
269
269
|
2. **`distributions`**: This argument accepts a list of strings where each string corresponds to a distribution. Valid options include:
|
270
270
|
- "Normal"
|
271
|
-
- "Lindley"
|
272
271
|
- "Uniform"
|
273
272
|
- "LogNormal"
|
274
273
|
- "Triangular"
|
275
|
-
- "Gamma"
|
276
274
|
- "TruncatedNormal"
|
277
275
|
- Any of the above, concatenated with ":" (e.g., "Normal:grouped"; requires a grouping term defined in the model)
|
278
276
|
|
279
277
|
3. **`Model`**: This argument specifies the model form. It can be a list of integers representing different models to test:
|
280
278
|
- 0: Poisson
|
281
279
|
- 1: Negative-Binomial
|
282
|
-
- 2: Generalized-Poisson
|
283
280
|
|
284
281
|
4. **`transformations`**: This argument accepts a list of strings representing available transformations within the framework. Valid options include:
|
285
282
|
- "no"
|
286
283
|
- "square-root"
|
287
284
|
- "logarithmic"
|
288
285
|
- "archsinh"
|
289
|
-
- "
|
286
|
+
- "nil"
|
290
287
|
|
291
288
|
5. **`is_multi`**: This argument accepts an integer indicating whether single or multiple objectives are to be tested (0 for single, 1 for multiple).
|
292
289
|
|
@@ -320,9 +317,9 @@ arguments = {
|
|
320
317
|
'val_percentage:': 0.2, # Saves 20% of data for testing.
|
321
318
|
'test_complexity': 3, # For Very simple Models
|
322
319
|
'obj_1': 'BIC', '_obj_2': 'RMSE_TEST',
|
323
|
-
'
|
320
|
+
'instance_name': 'hs_run', # used for creeating a named folder where your models are saved into from the directory
|
324
321
|
'distribution': ['Normal'],
|
325
|
-
'
|
322
|
+
'model_types': [0, 1], # or equivalently ['POS', 'NB']
|
326
323
|
'transformations': ['no', 'sqrt', 'archsinh'],
|
327
324
|
'_max_time': 10000
|
328
325
|
} '''Arguments for the solution algorithm'''
|
@@ -398,7 +395,7 @@ manual_fit_spec = {
|
|
398
395
|
'fixed_terms': ['const','YEAR'],
|
399
396
|
'rdm_terms': [],
|
400
397
|
'rdm_cor_terms': [],
|
401
|
-
'
|
398
|
+
'grouped_rdm': [],
|
402
399
|
'hetro_in_means': [],
|
403
400
|
'transformations': ['no', 'no'],
|
404
401
|
'dispersion': 1 #Negative Binomial
|
@@ -410,7 +407,7 @@ arguments = {
|
|
410
407
|
'algorithm': 'hs',
|
411
408
|
'test_percentage': 0,
|
412
409
|
'test_complexity': 6,
|
413
|
-
'
|
410
|
+
'instance': 'name',
|
414
411
|
'Manual_Fit': manual_fit_spec
|
415
412
|
}
|
416
413
|
obj_fun = ObjectiveFunction(data_exog, data_endog, **arguments)
|
@@ -64,7 +64,7 @@ X['Offset'] = np.log(df['AADT']) # Explicitley define how to offset the data, no
|
|
64
64
|
X = df.drop(columns=['FREQ', 'ID', 'AADT'])
|
65
65
|
|
66
66
|
#some example argument, these are defualt so the following line is just for claritity. See the later agruments section for detials.
|
67
|
-
arguments = {'algorithm': 'hs', 'test_percentage': 0.15, 'test_complexity': 6, '
|
67
|
+
arguments = {'algorithm': 'hs', 'test_percentage': 0.15, 'test_complexity': 6, 'instance_name':1,
|
68
68
|
'val_percentage':0.15, 'obj_1': 'bic', '_obj_2': 'RMSE_TEST', "_max_time": 6}
|
69
69
|
# Fit the model with metacountregressor
|
70
70
|
obj_fun = ObjectiveFunction(X, y, **arguments)
|
@@ -104,9 +104,9 @@ arguments = {
|
|
104
104
|
'test_percentage': 0.2, # used in multi-objective optimisation only. Saves 20% of data for testing.
|
105
105
|
'val_percenetage:': 0.2, # Saves 20% of data for testing.
|
106
106
|
'test_complexity': 6, # Complexity level for testing (6 tests all) or a list to consider potential differences in complexity
|
107
|
-
'
|
107
|
+
'instance_name': 'name', # used for creeting a named folder where your models are saved into from the directory
|
108
108
|
'distribution': ['Normal', 'LnNormal', 'Triangular', 'Uniform'],
|
109
|
-
'
|
109
|
+
'model_types': [[0,1]], # or equivalently ['POS', 'NB']
|
110
110
|
'transformations': ['no', 'sqrt', 'archsinh'],
|
111
111
|
'method_ll': 'BFGS_2',
|
112
112
|
'_max_time': 10
|
@@ -125,7 +125,7 @@ manual_fit_spec = {
|
|
125
125
|
'fixed_terms': ['SINGLE', 'LENGTH'],
|
126
126
|
'rdm_terms': ['AADT:normal'],
|
127
127
|
'rdm_cor_terms': ['GRADEBR:normal', 'CURVES:normal'],
|
128
|
-
'
|
128
|
+
'grouped_rdm': [],
|
129
129
|
'hetro_in_means': ['ACCESS:normal', 'MINRAD:normal'],
|
130
130
|
'transformations': ['no', 'no', 'log', 'no', 'no', 'no', 'no'],
|
131
131
|
'dispersion': 0
|
@@ -137,7 +137,7 @@ arguments = {
|
|
137
137
|
'algorithm': 'hs',
|
138
138
|
'test_percentage': 0.2,
|
139
139
|
'test_complexity': 6,
|
140
|
-
'
|
140
|
+
'instance_name': 'name',
|
141
141
|
'Manual_Fit': manual_fit_spec
|
142
142
|
}
|
143
143
|
obj_fun = ObjectiveFunction(X, y, **arguments)
|
@@ -237,25 +237,22 @@ The following list describes the arguments available in this function. By defaul
|
|
237
237
|
|
238
238
|
2. **`distributions`**: This argument accepts a list of strings where each string corresponds to a distribution. Valid options include:
|
239
239
|
- "Normal"
|
240
|
-
- "Lindley"
|
241
240
|
- "Uniform"
|
242
241
|
- "LogNormal"
|
243
242
|
- "Triangular"
|
244
|
-
- "Gamma"
|
245
243
|
- "TruncatedNormal"
|
246
244
|
- Any of the above, concatenated with ":" (e.g., "Normal:grouped"; requires a grouping term defined in the model)
|
247
245
|
|
248
246
|
3. **`Model`**: This argument specifies the model form. It can be a list of integers representing different models to test:
|
249
247
|
- 0: Poisson
|
250
248
|
- 1: Negative-Binomial
|
251
|
-
- 2: Generalized-Poisson
|
252
249
|
|
253
250
|
4. **`transformations`**: This argument accepts a list of strings representing available transformations within the framework. Valid options include:
|
254
251
|
- "no"
|
255
252
|
- "square-root"
|
256
253
|
- "logarithmic"
|
257
254
|
- "archsinh"
|
258
|
-
- "
|
255
|
+
- "nil"
|
259
256
|
|
260
257
|
5. **`is_multi`**: This argument accepts an integer indicating whether single or multiple objectives are to be tested (0 for single, 1 for multiple).
|
261
258
|
|
@@ -289,9 +286,9 @@ arguments = {
|
|
289
286
|
'val_percentage:': 0.2, # Saves 20% of data for testing.
|
290
287
|
'test_complexity': 3, # For Very simple Models
|
291
288
|
'obj_1': 'BIC', '_obj_2': 'RMSE_TEST',
|
292
|
-
'
|
289
|
+
'instance_name': 'hs_run', # used for creeating a named folder where your models are saved into from the directory
|
293
290
|
'distribution': ['Normal'],
|
294
|
-
'
|
291
|
+
'model_types': [0, 1], # or equivalently ['POS', 'NB']
|
295
292
|
'transformations': ['no', 'sqrt', 'archsinh'],
|
296
293
|
'_max_time': 10000
|
297
294
|
} '''Arguments for the solution algorithm'''
|
@@ -367,7 +364,7 @@ manual_fit_spec = {
|
|
367
364
|
'fixed_terms': ['const','YEAR'],
|
368
365
|
'rdm_terms': [],
|
369
366
|
'rdm_cor_terms': [],
|
370
|
-
'
|
367
|
+
'grouped_rdm': [],
|
371
368
|
'hetro_in_means': [],
|
372
369
|
'transformations': ['no', 'no'],
|
373
370
|
'dispersion': 1 #Negative Binomial
|
@@ -379,7 +376,7 @@ arguments = {
|
|
379
376
|
'algorithm': 'hs',
|
380
377
|
'test_percentage': 0,
|
381
378
|
'test_complexity': 6,
|
382
|
-
'
|
379
|
+
'instance': 'name',
|
383
380
|
'Manual_Fit': manual_fit_spec
|
384
381
|
}
|
385
382
|
obj_fun = ObjectiveFunction(data_exog, data_endog, **arguments)
|
@@ -91,7 +91,7 @@ the Pareto frontier.
|
|
91
91
|
X = df.drop(columns=['FREQ', 'ID', 'AADT'])
|
92
92
|
|
93
93
|
#some example argument, these are defualt so the following line is just for claritity. See the later agruments section for detials.
|
94
|
-
arguments = {'algorithm': 'hs', 'test_percentage': 0.15, 'test_complexity': 6, '
|
94
|
+
arguments = {'algorithm': 'hs', 'test_percentage': 0.15, 'test_complexity': 6, 'instance_name':1,
|
95
95
|
'val_percentage':0.15, 'obj_1': 'bic', '_obj_2': 'RMSE_TEST', "_max_time": 6}
|
96
96
|
# Fit the model with metacountregressor
|
97
97
|
obj_fun = ObjectiveFunction(X, y, **arguments)
|
@@ -158,9 +158,9 @@ code as a guide.
|
|
158
158
|
'test_percentage': 0.2, # used in multi-objective optimisation only. Saves 20% of data for testing.
|
159
159
|
'val_percenetage:': 0.2, # Saves 20% of data for testing.
|
160
160
|
'test_complexity': 6, # Complexity level for testing (6 tests all) or a list to consider potential differences in complexity
|
161
|
-
'
|
161
|
+
'instance_name': 'name', # used for creeting a named folder where your models are saved into from the directory
|
162
162
|
'distribution': ['Normal', 'LnNormal', 'Triangular', 'Uniform'],
|
163
|
-
'
|
163
|
+
'model_types': [[0,1]], # or equivalently ['POS', 'NB']
|
164
164
|
'transformations': ['no', 'sqrt', 'archsinh'],
|
165
165
|
'method_ll': 'BFGS_2',
|
166
166
|
'_max_time': 10
|
@@ -184,7 +184,7 @@ modeling components may completely replace the initial solution.
|
|
184
184
|
'fixed_terms': ['SINGLE', 'LENGTH'],
|
185
185
|
'rdm_terms': ['AADT:normal'],
|
186
186
|
'rdm_cor_terms': ['GRADEBR:normal', 'CURVES:normal'],
|
187
|
-
'
|
187
|
+
'grouped_rdm': [],
|
188
188
|
'hetro_in_means': ['ACCESS:normal', 'MINRAD:normal'],
|
189
189
|
'transformations': ['no', 'no', 'log', 'no', 'no', 'no', 'no'],
|
190
190
|
'dispersion': 0
|
@@ -196,7 +196,7 @@ modeling components may completely replace the initial solution.
|
|
196
196
|
'algorithm': 'hs',
|
197
197
|
'test_percentage': 0.2,
|
198
198
|
'test_complexity': 6,
|
199
|
-
'
|
199
|
+
'instance_name': 'name',
|
200
200
|
'Manual_Fit': manual_fit_spec
|
201
201
|
}
|
202
202
|
obj_fun = ObjectiveFunction(X, y, **arguments)
|
@@ -341,11 +341,9 @@ considered. Example code will be provided later in this guide.
|
|
341
341
|
each string corresponds to a distribution. Valid options include:
|
342
342
|
|
343
343
|
- �Normal�
|
344
|
-
- �Lindley�
|
345
344
|
- �Uniform�
|
346
345
|
- �LogNormal�
|
347
346
|
- �Triangular�
|
348
|
-
- �Gamma�
|
349
347
|
- �TruncatedNormal�
|
350
348
|
- Any of the above, concatenated with �:� (e.g., �Normal:grouped�;
|
351
349
|
requires a grouping term defined in the model)
|
@@ -355,7 +353,6 @@ considered. Example code will be provided later in this guide.
|
|
355
353
|
|
356
354
|
- 0: Poisson
|
357
355
|
- 1: Negative-Binomial
|
358
|
-
- 2: Generalized-Poisson
|
359
356
|
|
360
357
|
4. **``transformations``**: This argument accepts a list of strings
|
361
358
|
representing available transformations within the framework. Valid
|
@@ -365,7 +362,7 @@ considered. Example code will be provided later in this guide.
|
|
365
362
|
- �square-root�
|
366
363
|
- �logarithmic�
|
367
364
|
- �archsinh�
|
368
|
-
- �
|
365
|
+
- �nil�
|
369
366
|
|
370
367
|
5. **``is_multi``**: This argument accepts an integer indicating whether
|
371
368
|
single or multiple objectives are to be tested (0 for single, 1 for
|
@@ -413,9 +410,9 @@ factors for our search.
|
|
413
410
|
'val_percentage:': 0.2, # Saves 20% of data for testing.
|
414
411
|
'test_complexity': 3, # For Very simple Models
|
415
412
|
'obj_1': 'BIC', '_obj_2': 'RMSE_TEST',
|
416
|
-
'
|
413
|
+
'instance_name': 'hs_run', # used for creeating a named folder where your models are saved into from the directory
|
417
414
|
'distribution': ['Normal'],
|
418
|
-
'
|
415
|
+
'model_types': [0, 1], # or equivalently ['POS', 'NB']
|
419
416
|
'transformations': ['no', 'sqrt', 'archsinh'],
|
420
417
|
'_max_time': 10000
|
421
418
|
} '''Arguments for the solution algorithm'''
|
@@ -495,7 +492,7 @@ packages, including Statsmodels.
|
|
495
492
|
'fixed_terms': ['const','YEAR'],
|
496
493
|
'rdm_terms': [],
|
497
494
|
'rdm_cor_terms': [],
|
498
|
-
'
|
495
|
+
'grouped_rdm': [],
|
499
496
|
'hetro_in_means': [],
|
500
497
|
'transformations': ['no', 'no'],
|
501
498
|
'dispersion': 1 #Negative Binomial
|
@@ -507,7 +504,7 @@ packages, including Statsmodels.
|
|
507
504
|
'algorithm': 'hs',
|
508
505
|
'test_percentage': 0,
|
509
506
|
'test_complexity': 6,
|
510
|
-
'
|
507
|
+
'instance': 'name',
|
511
508
|
'Manual_Fit': manual_fit_spec
|
512
509
|
}
|
513
510
|
obj_fun = ObjectiveFunction(data_exog, data_endog, **arguments)
|
@@ -266,7 +266,7 @@ def simulated_annealing(objective_function, initial_slns=None, **kwargs):
|
|
266
266
|
# TEMP_ALPHA, MAX_STEPS, INTL_ACCEPT, STEPS, SWAP_PERC, NUM_INTL_SLNS, IS_MULTI= hyperparameters
|
267
267
|
man = None
|
268
268
|
try:
|
269
|
-
objective_function.
|
269
|
+
objective_function.instance_name = str(0)
|
270
270
|
except:
|
271
271
|
pass
|
272
272
|
if 'Manual_Fit' in kwargs:
|
@@ -297,7 +297,7 @@ def harmony_search(objective_function, initial_harmonies=None, hyperparameters=N
|
|
297
297
|
if kwargs.get('_hmcr') is not None:
|
298
298
|
objective_function._hmcr = kwargs.get('_hmcr')
|
299
299
|
try:
|
300
|
-
objective_function.
|
300
|
+
objective_function.instance_name = f"run_hs_{str(0)}"
|
301
301
|
except:
|
302
302
|
pass
|
303
303
|
|
@@ -335,7 +335,7 @@ class Metaheuristic(object):
|
|
335
335
|
self.F = kwargs['_AI'] # mustation scale
|
336
336
|
self.iter = kwargs.get('_max_iter', 10000)
|
337
337
|
self.cr = kwargs.get('_crossover_perc') or kwargs.get('_cr', 0.2)
|
338
|
-
self.
|
338
|
+
self.instance_name = str(kwargs.get('instance_name', 1))
|
339
339
|
if objective_function.is_multi:
|
340
340
|
|
341
341
|
self.obj_1 = objective_function._obj_1
|
@@ -424,7 +424,7 @@ class DifferentialEvolution(object):
|
|
424
424
|
def __init__(self, objective_function, **kwargs):
|
425
425
|
objective_function.algorithm = 'de'
|
426
426
|
try:
|
427
|
-
objective_function.
|
427
|
+
objective_function.instance_name = str(0)
|
428
428
|
except:
|
429
429
|
pass
|
430
430
|
self._obj_fun = objective_function
|
@@ -442,8 +442,8 @@ class DifferentialEvolution(object):
|
|
442
442
|
self.F = kwargs.get('_AI', 2) # mutation scale
|
443
443
|
self.iter = kwargs.get('_max_iter', 10000)
|
444
444
|
self.cr = kwargs.get('_crossover_perc') or kwargs.get('_cr', 0.2)
|
445
|
-
self.
|
446
|
-
self.
|
445
|
+
self.instance_name = str(kwargs.get('instance_name', 1))
|
446
|
+
self.instance_name = objective_function.instance_name
|
447
447
|
self.get_directory()
|
448
448
|
|
449
449
|
self._population = list()
|
@@ -461,13 +461,13 @@ class DifferentialEvolution(object):
|
|
461
461
|
def get_directory(self):
|
462
462
|
# checking if the directory demo_folder2
|
463
463
|
# exist or not.
|
464
|
-
if not os.path.isdir(self.
|
464
|
+
if not os.path.isdir(self.instance_name):
|
465
465
|
# if the demo_folder2 directory is
|
466
466
|
# not present then create it.
|
467
|
-
os.makedirs(self.
|
467
|
+
os.makedirs(self.instance_name)
|
468
468
|
|
469
469
|
def get_instance_name(self):
|
470
|
-
name = str(self.
|
470
|
+
name = str(self.instance_name) + '/log.csv'
|
471
471
|
return name
|
472
472
|
|
473
473
|
def _random_selection(self, sln, i):
|
@@ -666,18 +666,18 @@ class DifferentialEvolution(object):
|
|
666
666
|
self._population[j] = obj_trial
|
667
667
|
|
668
668
|
logger(self.it_process, obj_trial, self._population, True,
|
669
|
-
self.
|
669
|
+
self.instance_name + '/population_logger_strict_non_pareto.csv', 1)
|
670
670
|
logger(self.it_process, obj_trial, self._pareto_population, True,
|
671
|
-
self.
|
671
|
+
self.instance_name + '/population_logger_pareto.csv', 1)
|
672
672
|
else:
|
673
673
|
if self.pf.calculate_difference(obj_trial, self._population[j]):
|
674
674
|
iterations_without_improvement = 0
|
675
675
|
self._population[j] = obj_trial
|
676
676
|
self._pareto_population = self.pf.Pareto_F
|
677
677
|
logger(self.it_process, obj_trial, self._population, True,
|
678
|
-
self.
|
678
|
+
self.instance_name + '/population_logger_strict_non_pareto.csv', 1)
|
679
679
|
logger(self.it_process, obj_trial, self._pareto_population, True,
|
680
|
-
self.
|
680
|
+
self.instance_name + '/population_logger_pareto.csv', 1)
|
681
681
|
|
682
682
|
if it_best is None:
|
683
683
|
it_best = obj_trial
|
@@ -822,7 +822,7 @@ class SimulatedAnnealing(object):
|
|
822
822
|
self.temp_min = 0.05
|
823
823
|
self._MAX_ITERATIONS = int(kwargs.get('MAX_ITERATIONS', 10000)) or int(kwargs.get('_max_iter', 10000))
|
824
824
|
|
825
|
-
self.
|
825
|
+
self.instance_name = str(objective_function.instance_name)
|
826
826
|
self.accept = 0
|
827
827
|
self.profiler = []
|
828
828
|
self.update_t = self.cooling_linear_m
|
@@ -843,12 +843,12 @@ class SimulatedAnnealing(object):
|
|
843
843
|
def get_directory(self):
|
844
844
|
# checking if the directory demo_folder2
|
845
845
|
# exist or not.
|
846
|
-
if not os.path.isdir(self.
|
846
|
+
if not os.path.isdir(self.instance_name):
|
847
847
|
# not present then create it.
|
848
|
-
os.makedirs(self.
|
848
|
+
os.makedirs(self.instance_name)
|
849
849
|
|
850
850
|
def get_instance_name(self):
|
851
|
-
name = str(self.
|
851
|
+
name = str(self.instance_name) + '/log.csv'
|
852
852
|
return name
|
853
853
|
|
854
854
|
def run(self, initial_slns=None, mod_init=None):
|
@@ -939,7 +939,7 @@ class SimulatedAnnealing(object):
|
|
939
939
|
didchange = self.pf.did_it_change()
|
940
940
|
if didchange:
|
941
941
|
pareto_logger(self.pf.Pareto_F, iteration, self._obj_fun.complexity_level,
|
942
|
-
self._obj_fun.
|
942
|
+
self._obj_fun.instance_name)
|
943
943
|
self._current_energy = nbr_energy
|
944
944
|
self.current_struct = nbr_struct
|
945
945
|
self.accept += 1
|
@@ -1284,7 +1284,7 @@ class HarmonySearch(object):
|
|
1284
1284
|
self.F = kwargs.get('_AI', 2) # mutation scale
|
1285
1285
|
self.iter = kwargs.get('_max_iter', 10000)
|
1286
1286
|
self.cr = kwargs.get('_crossover_perc') or kwargs.get('_cr', 0.2)
|
1287
|
-
self.
|
1287
|
+
self.instance_name = str(kwargs.get('instance_name', 1))
|
1288
1288
|
|
1289
1289
|
|
1290
1290
|
|
@@ -1295,7 +1295,7 @@ class HarmonySearch(object):
|
|
1295
1295
|
# harmony_history stores all hms harmonies every nth improvisations (i.e., one 'generation')
|
1296
1296
|
self._harmony_history = list()
|
1297
1297
|
# saves the best fitness
|
1298
|
-
self.
|
1298
|
+
self.instance_name = str(objective_function.instance_name)
|
1299
1299
|
self.get_directory()
|
1300
1300
|
self._harmony_trace_best = list()
|
1301
1301
|
self._harmony_trace_incumbent = list()
|
@@ -1315,13 +1315,13 @@ class HarmonySearch(object):
|
|
1315
1315
|
def get_directory(self):
|
1316
1316
|
# checking if the directory demo_folder2
|
1317
1317
|
# exist or not.
|
1318
|
-
if not os.path.isdir(self.
|
1318
|
+
if not os.path.isdir(self.instance_name):
|
1319
1319
|
# if the demo_folder2 directory is
|
1320
1320
|
# not present then create it.
|
1321
|
-
os.makedirs(self.
|
1321
|
+
os.makedirs(self.instance_name)
|
1322
1322
|
|
1323
1323
|
def get_instance_name(self):
|
1324
|
-
name = str(self.
|
1324
|
+
name = str(self.instance_name) + '/log.csv'
|
1325
1325
|
return name
|
1326
1326
|
|
1327
1327
|
def hard_mutate_index_and_value(self):
|
@@ -1432,7 +1432,7 @@ class HarmonySearch(object):
|
|
1432
1432
|
1) # for consistency
|
1433
1433
|
except Exception as e:
|
1434
1434
|
print(e, 'logger run hs')
|
1435
|
-
# logger(num_imp, fitness, self._pareto_harmony_memory, True, self.
|
1435
|
+
# logger(num_imp, fitness, self._pareto_harmony_memory, True, self.instance_name +'/log_for_pareto_harmony_memory.csv', 1)
|
1436
1436
|
|
1437
1437
|
|
1438
1438
|
else:
|
@@ -1477,7 +1477,7 @@ class HarmonySearch(object):
|
|
1477
1477
|
|
1478
1478
|
else:
|
1479
1479
|
pareto_logger(self._pareto_harmony_memory, num_imp / self._obj_fun.get_hms(),
|
1480
|
-
self._obj_fun.complexity_level, self._obj_fun.
|
1480
|
+
self._obj_fun.complexity_level, self._obj_fun.instance_name)
|
1481
1481
|
generation += 1
|
1482
1482
|
iterations_without_improvement += 1
|
1483
1483
|
|
@@ -1915,7 +1915,7 @@ class Mutlithreaded_Meta(DifferentialEvolution, SimulatedAnnealing, HarmonySearc
|
|
1915
1915
|
logger(num_imp, fitness, self._harmony_memory, True, self.get_instance_name(),
|
1916
1916
|
1) # for consistency
|
1917
1917
|
logger(num_imp, fitness, self._pareto_harmony_memory, True,
|
1918
|
-
self.
|
1918
|
+
self.instance_name + '/log_for_pareto_harmony_memory.csv', 1)
|
1919
1919
|
|
1920
1920
|
|
1921
1921
|
else:
|
@@ -1960,7 +1960,7 @@ class Mutlithreaded_Meta(DifferentialEvolution, SimulatedAnnealing, HarmonySearc
|
|
1960
1960
|
|
1961
1961
|
else:
|
1962
1962
|
pareto_logger(self._pareto_harmony_memory, num_imp / self._obj_fun.get_hms(),
|
1963
|
-
self._obj_fun.complexity_level, self._obj_fun.
|
1963
|
+
self._obj_fun.complexity_level, self._obj_fun.instance_name)
|
1964
1964
|
generation += 1
|
1965
1965
|
iterations_without_improvement += 1
|
1966
1966
|
|
@@ -2081,7 +2081,7 @@ class Mutlithreaded_Meta(DifferentialEvolution, SimulatedAnnealing, HarmonySearc
|
|
2081
2081
|
didchange = self.pf.did_it_change()
|
2082
2082
|
if didchange:
|
2083
2083
|
pareto_logger(self.pf.Pareto_F, iteration, self._obj_fun.complexity_level,
|
2084
|
-
self._obj_fun.
|
2084
|
+
self._obj_fun.instance_name)
|
2085
2085
|
current_energy[j] = nbr_energy
|
2086
2086
|
|
2087
2087
|
self.accept += 1
|
@@ -2278,18 +2278,18 @@ class Mutlithreaded_Meta(DifferentialEvolution, SimulatedAnnealing, HarmonySearc
|
|
2278
2278
|
self._population[j] = obj_trial
|
2279
2279
|
|
2280
2280
|
logger(self.it_process, obj_trial, self._population, True,
|
2281
|
-
self.
|
2281
|
+
self.instance_name + '/population_logger_strict_non_pareto.csv', 1)
|
2282
2282
|
logger(self.it_process, obj_trial, self._pareto_population, True,
|
2283
|
-
self.
|
2283
|
+
self.instance_name + '/population_logger_pareto.csv', 1)
|
2284
2284
|
else:
|
2285
2285
|
if self.pf.calculate_difference(obj_trial, self._population[j]):
|
2286
2286
|
iterations_without_improvement = 0
|
2287
2287
|
self._population[j] = obj_trial
|
2288
2288
|
self._pareto_population = self.pf.Pareto_F
|
2289
2289
|
logger(self.it_process, obj_trial, self._population, True,
|
2290
|
-
self.
|
2290
|
+
self.instance_name + '/population_logger_strict_non_pareto.csv', 1)
|
2291
2291
|
logger(self.it_process, obj_trial, self._pareto_population, True,
|
2292
|
-
self.
|
2292
|
+
self.instance_name + '/population_logger_pareto.csv', 1)
|
2293
2293
|
|
2294
2294
|
if it_best is None:
|
2295
2295
|
it_best = obj_trial
|
@@ -212,19 +212,19 @@ class ObjectiveFunction(object):
|
|
212
212
|
if 'complexity_level' in kwargs:
|
213
213
|
self.complexity_level = kwargs['complexity_level']
|
214
214
|
|
215
|
-
if '
|
216
|
-
self.
|
215
|
+
if 'instance_name' in kwargs:
|
216
|
+
self.instance_name = str(kwargs['instance_name'])
|
217
217
|
else:
|
218
218
|
|
219
219
|
print('no name set, setting name as 0')
|
220
|
-
self.
|
220
|
+
self.instance_name = f"run_{str(0)}" # set an arbitrary instance number
|
221
221
|
|
222
222
|
if kwargs.get('save_directory', True):
|
223
223
|
self.save_state = True
|
224
|
-
if not os.path.exists(self.
|
224
|
+
if not os.path.exists(self.instance_name):
|
225
225
|
if kwargs.get('make_directory', True):
|
226
226
|
print('Making a Directory, if you want to stop from storing the files to this directory set argumet: make_directory:False')
|
227
|
-
os.makedirs(self.
|
227
|
+
os.makedirs(self.instance_name)
|
228
228
|
else:
|
229
229
|
self.save_state = False
|
230
230
|
if not hasattr(self, '_obj_1'):
|
@@ -456,7 +456,7 @@ class ObjectiveFunction(object):
|
|
456
456
|
self._transformations = kwargs.get('_transformations', ["no", "log", "sqrt", "arcsinh", "nil"])
|
457
457
|
# self._distribution = ['triangular', 'uniform', 'normal', 'ln_normal', 'tn_normal', 'lindley']
|
458
458
|
|
459
|
-
self._distribution = kwargs.get('_distributions', ['triangular', 'uniform', 'normal', 'tn_normal'])
|
459
|
+
self._distribution = kwargs.get('_distributions', ['triangular', 'uniform', 'normal', 'tn_normal', 'ln_normal'])
|
460
460
|
|
461
461
|
if self.G is not None:
|
462
462
|
#TODO need to handle this for groups
|
@@ -1263,10 +1263,10 @@ class ObjectiveFunction(object):
|
|
1263
1263
|
caption = " ".join(caption_parts)
|
1264
1264
|
# print(latextable.draw_latex(table, caption=caption, caption_above = True))
|
1265
1265
|
if solution is None:
|
1266
|
-
file_name = self.
|
1266
|
+
file_name = self.instance_name + "/sln" + \
|
1267
1267
|
"_with_BIC_" + str(self.bic) + ".tex"
|
1268
1268
|
else:
|
1269
|
-
file_name = self.
|
1269
|
+
file_name = self.instance_name + "/sln" + \
|
1270
1270
|
str(solution['sol_num']) + \
|
1271
1271
|
"_with_BIC_" + str(self.bic) + ".tex"
|
1272
1272
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: metacountregressor
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.6
|
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
|
@@ -95,7 +95,7 @@ X['Offset'] = np.log(df['AADT']) # Explicitley define how to offset the data, no
|
|
95
95
|
X = df.drop(columns=['FREQ', 'ID', 'AADT'])
|
96
96
|
|
97
97
|
#some example argument, these are defualt so the following line is just for claritity. See the later agruments section for detials.
|
98
|
-
arguments = {'algorithm': 'hs', 'test_percentage': 0.15, 'test_complexity': 6, '
|
98
|
+
arguments = {'algorithm': 'hs', 'test_percentage': 0.15, 'test_complexity': 6, 'instance_name':1,
|
99
99
|
'val_percentage':0.15, 'obj_1': 'bic', '_obj_2': 'RMSE_TEST', "_max_time": 6}
|
100
100
|
# Fit the model with metacountregressor
|
101
101
|
obj_fun = ObjectiveFunction(X, y, **arguments)
|
@@ -135,9 +135,9 @@ arguments = {
|
|
135
135
|
'test_percentage': 0.2, # used in multi-objective optimisation only. Saves 20% of data for testing.
|
136
136
|
'val_percenetage:': 0.2, # Saves 20% of data for testing.
|
137
137
|
'test_complexity': 6, # Complexity level for testing (6 tests all) or a list to consider potential differences in complexity
|
138
|
-
'
|
138
|
+
'instance_name': 'name', # used for creeting a named folder where your models are saved into from the directory
|
139
139
|
'distribution': ['Normal', 'LnNormal', 'Triangular', 'Uniform'],
|
140
|
-
'
|
140
|
+
'model_types': [[0,1]], # or equivalently ['POS', 'NB']
|
141
141
|
'transformations': ['no', 'sqrt', 'archsinh'],
|
142
142
|
'method_ll': 'BFGS_2',
|
143
143
|
'_max_time': 10
|
@@ -156,7 +156,7 @@ manual_fit_spec = {
|
|
156
156
|
'fixed_terms': ['SINGLE', 'LENGTH'],
|
157
157
|
'rdm_terms': ['AADT:normal'],
|
158
158
|
'rdm_cor_terms': ['GRADEBR:normal', 'CURVES:normal'],
|
159
|
-
'
|
159
|
+
'grouped_rdm': [],
|
160
160
|
'hetro_in_means': ['ACCESS:normal', 'MINRAD:normal'],
|
161
161
|
'transformations': ['no', 'no', 'log', 'no', 'no', 'no', 'no'],
|
162
162
|
'dispersion': 0
|
@@ -168,7 +168,7 @@ arguments = {
|
|
168
168
|
'algorithm': 'hs',
|
169
169
|
'test_percentage': 0.2,
|
170
170
|
'test_complexity': 6,
|
171
|
-
'
|
171
|
+
'instance_name': 'name',
|
172
172
|
'Manual_Fit': manual_fit_spec
|
173
173
|
}
|
174
174
|
obj_fun = ObjectiveFunction(X, y, **arguments)
|
@@ -268,25 +268,22 @@ The following list describes the arguments available in this function. By defaul
|
|
268
268
|
|
269
269
|
2. **`distributions`**: This argument accepts a list of strings where each string corresponds to a distribution. Valid options include:
|
270
270
|
- "Normal"
|
271
|
-
- "Lindley"
|
272
271
|
- "Uniform"
|
273
272
|
- "LogNormal"
|
274
273
|
- "Triangular"
|
275
|
-
- "Gamma"
|
276
274
|
- "TruncatedNormal"
|
277
275
|
- Any of the above, concatenated with ":" (e.g., "Normal:grouped"; requires a grouping term defined in the model)
|
278
276
|
|
279
277
|
3. **`Model`**: This argument specifies the model form. It can be a list of integers representing different models to test:
|
280
278
|
- 0: Poisson
|
281
279
|
- 1: Negative-Binomial
|
282
|
-
- 2: Generalized-Poisson
|
283
280
|
|
284
281
|
4. **`transformations`**: This argument accepts a list of strings representing available transformations within the framework. Valid options include:
|
285
282
|
- "no"
|
286
283
|
- "square-root"
|
287
284
|
- "logarithmic"
|
288
285
|
- "archsinh"
|
289
|
-
- "
|
286
|
+
- "nil"
|
290
287
|
|
291
288
|
5. **`is_multi`**: This argument accepts an integer indicating whether single or multiple objectives are to be tested (0 for single, 1 for multiple).
|
292
289
|
|
@@ -320,9 +317,9 @@ arguments = {
|
|
320
317
|
'val_percentage:': 0.2, # Saves 20% of data for testing.
|
321
318
|
'test_complexity': 3, # For Very simple Models
|
322
319
|
'obj_1': 'BIC', '_obj_2': 'RMSE_TEST',
|
323
|
-
'
|
320
|
+
'instance_name': 'hs_run', # used for creeating a named folder where your models are saved into from the directory
|
324
321
|
'distribution': ['Normal'],
|
325
|
-
'
|
322
|
+
'model_types': [0, 1], # or equivalently ['POS', 'NB']
|
326
323
|
'transformations': ['no', 'sqrt', 'archsinh'],
|
327
324
|
'_max_time': 10000
|
328
325
|
} '''Arguments for the solution algorithm'''
|
@@ -398,7 +395,7 @@ manual_fit_spec = {
|
|
398
395
|
'fixed_terms': ['const','YEAR'],
|
399
396
|
'rdm_terms': [],
|
400
397
|
'rdm_cor_terms': [],
|
401
|
-
'
|
398
|
+
'grouped_rdm': [],
|
402
399
|
'hetro_in_means': [],
|
403
400
|
'transformations': ['no', 'no'],
|
404
401
|
'dispersion': 1 #Negative Binomial
|
@@ -410,7 +407,7 @@ arguments = {
|
|
410
407
|
'algorithm': 'hs',
|
411
408
|
'test_percentage': 0,
|
412
409
|
'test_complexity': 6,
|
413
|
-
'
|
410
|
+
'instance': 'name',
|
414
411
|
'Manual_Fit': manual_fit_spec
|
415
412
|
}
|
416
413
|
obj_fun = ObjectiveFunction(data_exog, data_endog, **arguments)
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.6
|
@@ -1 +0,0 @@
|
|
1
|
-
1.0.5
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/data_split_helper.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/pareto_logger__plot.py
RENAMED
File without changes
|
File without changes
|
{metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/single_objective_finder.py
RENAMED
File without changes
|
File without changes
|
{metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor/test_generated_paper2.py
RENAMED
File without changes
|
{metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor.egg-info/not-zip-safe
RENAMED
File without changes
|
{metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor.egg-info/requires.txt
RENAMED
File without changes
|
{metacountregressor-1.0.5 → metacountregressor-1.0.6}/metacountregressor.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|