metacountregressor 0.1.136__py3-none-any.whl → 0.1.139__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.
@@ -1,9 +1,12 @@
1
+ from os.path import exists
2
+
1
3
  import numpy as np
2
4
  import pandas as pd
3
5
  import csv
4
6
  import matplotlib.pyplot as plt
5
7
  from scipy import stats as st
6
8
  from sklearn.preprocessing import StandardScaler
9
+ from win32comext.shell.demos.IActiveDesktop import existing_item
7
10
 
8
11
  plt.style.use('https://github.com/dhaitz/matplotlib-stylesheets/raw/master/pitayasmoothie-dark.mplstyle')
9
12
 
@@ -179,15 +182,81 @@ config = {
179
182
  }
180
183
  }
181
184
  '''
185
+ def null_handler(vari):
186
+ if vari in locals():
187
+ return vari
188
+ else:
189
+ print(f'{vari} does not exist, setting None..')
190
+ return None
191
+
192
+
193
+ def set_up_analyst_constraints(data_characteristic, model_terms, variable_decisions_alt = None):
182
194
 
183
195
 
196
+ name_data_characteristics = data_characteristic.columns.tolist()
197
+ # Get non-None values as a list
198
+ non_none_terms = [value for value in model_terms.values() if value is not None]
199
+ # how to make name_data_characteristics - non_none_terms
200
+
201
+ result = [item for item in name_data_characteristics if item not in non_none_terms]
202
+ distu = ['Normal', 'Uniform', 'Triangular']
203
+ tra = ['no', 'sqrt', 'arcsinh']
204
+ if model_terms.get('grouped') is None:
205
+ print('cant have grouped rpm, removing level 4 from every item')
206
+ MAKE_ALL_4_FALSE = True
207
+ else:
208
+ MAKE_ALL_4_FALSE = False
209
+
210
+ variable_decisions = {
211
+ name: {
212
+ 'levels': list(range(6)),
213
+ 'distributions': distu,
214
+ 'transformations': tra
215
+ }
216
+ for name in result
217
+ }
218
+ # Override elements in the original dictionary with the alt dictionary
219
+ if variable_decisions_alt is not None:
220
+ for key, alt_value in variable_decisions_alt.items():
221
+ if key in variable_decisions:
222
+ # Update the existing entry
223
+ variable_decisions[key].update(alt_value)
224
+ else:
225
+ # Add new entry if it doesn't exist
226
+ variable_decisions[key] = alt_value
227
+ # Prepare the data for the DataFrame
228
+ rows = []
229
+ for column_name, details in variable_decisions.items():
230
+ # Create a row dictionary
231
+ row = {'Column': column_name}
232
+
233
+ # Add levels as True/False for Level 0 through Level 5
234
+ for level in range(6): # Assuming Level 0 to Level 5
235
+
236
+ if level == 4 and MAKE_ALL_4_FALSE:
237
+ row[f'Level {level}'] = False
238
+ else:
239
+ row[f'Level {level}'] = level in details['levels']
240
+
241
+ # Add distributions and transformations directly
242
+ row['distributions'] = details['distributions']
243
+ row['transformations'] = details['transformations']
244
+
245
+ rows.append(row)
246
+
247
+ # Create the DataFrame
248
+ df = pd.DataFrame(rows)
249
+
250
+ data_new = data_characteristic.rename(columns={v: k for k, v in model_terms.items() if v in data_characteristic.columns})
251
+ return df, data_new
252
+
184
253
  # Function to guess Low, Medium, High ranges
185
254
  def guess_low_medium_high(column_name, series):
186
255
  # Compute the tertiles (33rd and 66th percentiles)
187
- print('did it make it...')
188
- mode_value = st.mode(series) # Get the most frequent value
189
- print('good')
190
- series = pd.to_numeric(series, errors='coerce').fillna(mode_value)
256
+ #print('did it make it...')
257
+ #mode_value = st.mode(series) # Get the most frequent value
258
+ #print('good')
259
+ # series = pd.to_numeric(series, errors='coerce').fillna(mode_value)
191
260
  low_threshold = np.quantile(series, 0.33)
192
261
  high_threshold = np.quantile(series,0.66)
193
262
 
@@ -28,11 +28,16 @@ def convert_df_columns_to_binary_and_wide(df):
28
28
  return df
29
29
 
30
30
 
31
+
32
+
33
+
34
+
31
35
  def process_arguments(**kwargs):
32
36
  '''
33
37
  TRYING TO TURN THE CSV FILES INTO RELEVANT ARGS
34
38
  '''
35
39
  #dataset
40
+ '''
36
41
  if kwargs.get('dataset_file', False
37
42
  ):
38
43
  dataset = pd.read_csv(kwargs.get('dataset_file'))
@@ -71,15 +76,15 @@ def process_arguments(**kwargs):
71
76
 
72
77
  update_constant = kwargs.get('analyst_constraints')
73
78
  #update the decision_constraints
74
-
79
+ '''
75
80
  data_characteristic = pd.read_csv(kwargs.get('problem_data', 'problem_data.csv'))
76
81
  # Extract the column as a list of characteristic names
77
- name_data_characteristics = data_characteristic.columns.tolist()
82
+ #name_data_characteristics = data_characteristic.columns.tolist()
78
83
 
79
84
  # Create the dictionary
80
- decision_constraints = {name: list(range(7)) for name in name_data_characteristics}
85
+ #decision_constraints = {name: list(range(7)) for name in name_data_characteristics}
81
86
 
82
- print('this gets all the features, I need to remove...')
87
+ #print('this gets all the features, I need to remove...')
83
88
 
84
89
  analyst_d = pd.read_csv(kwargs.get('decison_constraints', 'decisions.csv'))
85
90
  hyper = pd.read_csv('setup_hyper.csv')
@@ -377,10 +382,10 @@ def main(args, **kwargs):
377
382
  #data_info['data']['Panel'][0]
378
383
  args['decisions'] = data_info['analyst']
379
384
 
380
- if not np.isnan(data_info['data']['Grouped'][0]):
385
+ if type(data_info['data']['Grouped'][0]) == str and len(data_info['data']['Grouped'][0]) >1:
381
386
  args['group'] = data_info['data']['Grouped'][0]
382
387
  args['ID'] = data_info['data']['Grouped'][0]
383
- if not np.isnan(data_info['data']['Panel'][0]):
388
+ if type(data_info['data']['Panel'][0]) == str and len(data_info['data']['Panel'][0])>1:
384
389
  args['panels'] = data_info['data']['Panel'][0]
385
390
 
386
391
  df = pd.read_csv(str(data_info['data']['Problem'][0]))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: metacountregressor
3
- Version: 0.1.136
3
+ Version: 0.1.139
4
4
  Summary: Extensions for a Python package for estimation of count models.
5
5
  Home-page: https://github.com/zahern/CountDataEstimation
6
6
  Author: Zeke Ahern
@@ -3,8 +3,8 @@ 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=W1iOZ_5QGMaWhKZvY6PaWeK5yJZAbJCRdfMro7jfBjA,17994
7
- metacountregressor/main.py,sha256=_MVROd1y8qIhvGnG1iFzHw4_2e6-8INjXHDnYlDSLy8,22714
6
+ metacountregressor/helperprocess.py,sha256=WiCItpiGJQJNxwczsNzWobDeltfmSKzSJKlxz8_9pxk,20504
7
+ metacountregressor/main.py,sha256=2Rx_mGIGzl4lhwkMb7DHvsBaawqEakKiVR1Yr2uG9Yo,22819
8
8
  metacountregressor/main_old.py,sha256=eTS4ygq27MnU-dZ_j983Ucb-D5XfbVF8OJQK2hVVLZc,24123
9
9
  metacountregressor/metaheuristics.py,sha256=Kkx1Jfox6NBlm5zVrI26Vc_NI7NFQSS9dinrZU9SpV8,105871
10
10
  metacountregressor/pareto_file.py,sha256=whySaoPAUWYjyI8zo0hwAOa3rFk6SIUlHSpqZiLur0k,23096
@@ -13,8 +13,8 @@ metacountregressor/setup.py,sha256=5UcQCCLR8Fm5odA3MX78WwahavxFq4mVD6oq0IuQvAY,9
13
13
  metacountregressor/single_objective_finder.py,sha256=jVG7GJBqzSP4_riYr-kMMKy_LE3SlGmKMunNhHYxgRg,8011
14
14
  metacountregressor/solution.py,sha256=6qAtCSKNvmrCpIpBCzp2Zt8wWKZBHRQtTriyiMHUo54,277519
15
15
  metacountregressor/test_generated_paper2.py,sha256=pwOoRzl1jJIIOUAAvbkT6HmmTQ81mwpsshn9SLdKOg8,3927
16
- metacountregressor-0.1.136.dist-info/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
17
- metacountregressor-0.1.136.dist-info/METADATA,sha256=xaLgLobGX8K3ibCWEOtcnjFfEfsciq8gs9lRv-WM6JE,23434
18
- metacountregressor-0.1.136.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
19
- metacountregressor-0.1.136.dist-info/top_level.txt,sha256=zGG7UC5WIpr76gsFUpwJ4En2aCcoNTONBaS3OewwjR0,19
20
- metacountregressor-0.1.136.dist-info/RECORD,,
16
+ metacountregressor-0.1.139.dist-info/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
17
+ metacountregressor-0.1.139.dist-info/METADATA,sha256=_jvPMVa-G1tSUPlH9VjpCAPT1nl6TCFWSsq6SMDwTw8,23434
18
+ metacountregressor-0.1.139.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
19
+ metacountregressor-0.1.139.dist-info/top_level.txt,sha256=zGG7UC5WIpr76gsFUpwJ4En2aCcoNTONBaS3OewwjR0,19
20
+ metacountregressor-0.1.139.dist-info/RECORD,,