metacountregressor 0.1.132__tar.gz → 0.1.134__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.132 → metacountregressor-0.1.134}/PKG-INFO +1 -1
  2. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor/helperprocess.py +17 -3
  3. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor.egg-info/PKG-INFO +1 -1
  4. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/LICENSE.txt +0 -0
  5. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/README.rst +0 -0
  6. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor/__init__.py +0 -0
  7. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor/_device_cust.py +0 -0
  8. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor/app_main.py +0 -0
  9. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor/data_split_helper.py +0 -0
  10. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor/halton.py +0 -0
  11. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor/main.py +0 -0
  12. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor/main_old.py +0 -0
  13. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor/metaheuristics.py +0 -0
  14. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor/pareto_file.py +0 -0
  15. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor/pareto_logger__plot.py +0 -0
  16. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor/setup.py +0 -0
  17. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor/single_objective_finder.py +0 -0
  18. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor/solution.py +0 -0
  19. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor/test_generated_paper2.py +0 -0
  20. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor.egg-info/SOURCES.txt +0 -0
  21. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor.egg-info/dependency_links.txt +0 -0
  22. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor.egg-info/not-zip-safe +0 -0
  23. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor.egg-info/requires.txt +0 -0
  24. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/metacountregressor.egg-info/top_level.txt +0 -0
  25. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/setup.cfg +0 -0
  26. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/setup.py +0 -0
  27. {metacountregressor-0.1.132 → metacountregressor-0.1.134}/tests/test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: metacountregressor
3
- Version: 0.1.132
3
+ Version: 0.1.134
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
@@ -2,6 +2,7 @@ import numpy as np
2
2
  import pandas as pd
3
3
  import csv
4
4
  import matplotlib.pyplot as plt
5
+ from scipy import stats as st
5
6
  from sklearn.preprocessing import StandardScaler
6
7
 
7
8
  plt.style.use('https://github.com/dhaitz/matplotlib-stylesheets/raw/master/pitayasmoothie-dark.mplstyle')
@@ -184,7 +185,7 @@ config = {
184
185
  def guess_low_medium_high(column_name, series):
185
186
  # Compute the tertiles (33rd and 66th percentiles)
186
187
  print('did it make it...')
187
- mode_value = np.mode(series) # Get the most frequent value
188
+ mode_value = st.mode(series) # Get the most frequent value
188
189
  print('good')
189
190
  series = pd.to_numeric(series, errors='coerce').fillna(mode_value)
190
191
  low_threshold = np.quantile(series, 0.33)
@@ -192,7 +193,19 @@ def guess_low_medium_high(column_name, series):
192
193
 
193
194
  # Define the bins and labels
194
195
  bins = [np.min(series) - 1, low_threshold, high_threshold, np.max(series)]
195
- labels = ['Low', 'Medium', 'High']
196
+ # Handle duplicate bins by adjusting labels
197
+ if len(set(bins)) < len(bins): # Check for duplicate bin edges
198
+ if low_threshold == high_threshold:
199
+ # Collapse to two bins (Low and High)
200
+ bins = [np.min(series) - 1, low_threshold, np.max(series)]
201
+ labels = ['Low', 'High']
202
+ else:
203
+ # Collapse to three unique bins
204
+ bins = sorted(set(bins)) # Remove duplicate edges
205
+ labels = [f'Bin {i + 1}' for i in range(len(bins) - 1)]
206
+ else:
207
+ # Standard case: Low, Medium, High
208
+ labels = ['Low', 'Medium', 'High']
196
209
 
197
210
  return {
198
211
  'type': 'bin',
@@ -211,7 +224,8 @@ def transform_dataframe(df, config):
211
224
  df[column],
212
225
  bins=settings['bins'],
213
226
  labels=settings['labels'],
214
- right=False
227
+ right=False,
228
+
215
229
  )
216
230
  # One-hot encode the binned column
217
231
  binned_dummies = pd.get_dummies(binned, prefix=settings['prefix'])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: metacountregressor
3
- Version: 0.1.132
3
+ Version: 0.1.134
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