metacountregressor 0.1.130__tar.gz → 0.1.133__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/PKG-INFO +1 -1
  2. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor/helperprocess.py +20 -4
  3. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor.egg-info/PKG-INFO +1 -1
  4. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/LICENSE.txt +0 -0
  5. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/README.rst +0 -0
  6. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor/__init__.py +0 -0
  7. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor/_device_cust.py +0 -0
  8. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor/app_main.py +0 -0
  9. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor/data_split_helper.py +0 -0
  10. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor/halton.py +0 -0
  11. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor/main.py +0 -0
  12. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor/main_old.py +0 -0
  13. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor/metaheuristics.py +0 -0
  14. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor/pareto_file.py +0 -0
  15. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor/pareto_logger__plot.py +0 -0
  16. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor/setup.py +0 -0
  17. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor/single_objective_finder.py +0 -0
  18. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor/solution.py +0 -0
  19. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor/test_generated_paper2.py +0 -0
  20. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor.egg-info/SOURCES.txt +0 -0
  21. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor.egg-info/dependency_links.txt +0 -0
  22. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor.egg-info/not-zip-safe +0 -0
  23. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor.egg-info/requires.txt +0 -0
  24. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/metacountregressor.egg-info/top_level.txt +0 -0
  25. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/setup.cfg +0 -0
  26. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/setup.py +0 -0
  27. {metacountregressor-0.1.130 → metacountregressor-0.1.133}/tests/test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: metacountregressor
3
- Version: 0.1.130
3
+ Version: 0.1.133
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
@@ -183,15 +183,28 @@ config = {
183
183
  # Function to guess Low, Medium, High ranges
184
184
  def guess_low_medium_high(column_name, series):
185
185
  # Compute the tertiles (33rd and 66th percentiles)
186
- print('why')
186
+ print('did it make it...')
187
187
  mode_value = np.mode(series) # Get the most frequent value
188
+ print('good')
188
189
  series = pd.to_numeric(series, errors='coerce').fillna(mode_value)
189
190
  low_threshold = np.quantile(series, 0.33)
190
191
  high_threshold = np.quantile(series,0.66)
191
192
 
192
193
  # Define the bins and labels
193
194
  bins = [np.min(series) - 1, low_threshold, high_threshold, np.max(series)]
194
- labels = ['Low', 'Medium', 'High']
195
+ # Handle duplicate bins by adjusting labels
196
+ if len(set(bins)) < len(bins): # Check for duplicate bin edges
197
+ if low_threshold == high_threshold:
198
+ # Collapse to two bins (Low and High)
199
+ bins = [np.min(series) - 1, low_threshold, np.max(series)]
200
+ labels = ['Low', 'High']
201
+ else:
202
+ # Collapse to three unique bins
203
+ bins = sorted(set(bins)) # Remove duplicate edges
204
+ labels = [f'Bin {i + 1}' for i in range(len(bins) - 1)]
205
+ else:
206
+ # Standard case: Low, Medium, High
207
+ labels = ['Low', 'Medium', 'High']
195
208
 
196
209
  return {
197
210
  'type': 'bin',
@@ -210,7 +223,8 @@ def transform_dataframe(df, config):
210
223
  df[column],
211
224
  bins=settings['bins'],
212
225
  labels=settings['labels'],
213
- right=False
226
+ right=False,
227
+
214
228
  )
215
229
  # One-hot encode the binned column
216
230
  binned_dummies = pd.get_dummies(binned, prefix=settings['prefix'])
@@ -250,12 +264,14 @@ def guess_column_type(column_name, series):
250
264
  return {'type': 'one-hot', 'prefix': column_name}
251
265
  elif pd.api.types.is_numeric_dtype(series):
252
266
  unique_values = series.nunique()
267
+
253
268
  if unique_values < 5:
254
269
  return {'type': 'one-hot', 'prefix': column_name}
255
270
 
256
271
  elif np.max(series) - np.min(series) > 20:
272
+ print('made it through here')
257
273
  # If there are few unique values, assume binning with default bins
258
- guess_low_medium_high(column_name,series)
274
+ return guess_low_medium_high(column_name,series)
259
275
  else:
260
276
  # # Otherwise, assume continuous data with normalization
261
277
  # Otherwise, fallback to continuous standardization
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: metacountregressor
3
- Version: 0.1.130
3
+ Version: 0.1.133
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