dragon-ml-toolbox 3.12.3__py3-none-any.whl → 3.12.5__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.

Potentially problematic release.


This version of dragon-ml-toolbox might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dragon-ml-toolbox
3
- Version: 3.12.3
3
+ Version: 3.12.5
4
4
  Summary: A collection of tools for data science and machine learning projects.
5
5
  Author-email: Karl Loza <luigiloza@gmail.com>
6
6
  License-Expression: MIT
@@ -1,7 +1,7 @@
1
- dragon_ml_toolbox-3.12.3.dist-info/licenses/LICENSE,sha256=2uUFNy7D0TLgHim1K5s3DIJ4q_KvxEXVilnU20cWliY,1066
2
- dragon_ml_toolbox-3.12.3.dist-info/licenses/LICENSE-THIRD-PARTY.md,sha256=lY4_rJPnLnMu7YBQaY-_iz1JRDcLdQzNCyeLAF1glJY,1837
1
+ dragon_ml_toolbox-3.12.5.dist-info/licenses/LICENSE,sha256=2uUFNy7D0TLgHim1K5s3DIJ4q_KvxEXVilnU20cWliY,1066
2
+ dragon_ml_toolbox-3.12.5.dist-info/licenses/LICENSE-THIRD-PARTY.md,sha256=lY4_rJPnLnMu7YBQaY-_iz1JRDcLdQzNCyeLAF1glJY,1837
3
3
  ml_tools/ETL_engineering.py,sha256=yeZsW_7zRvEcuMZbM4E2GV1dxwBoWIeJAcFFk2AK0fY,39502
4
- ml_tools/GUI_tools.py,sha256=gaLL4_fMQoKLreql0Jkz8fiYeeEfCmgxht-zE7pstAU,43024
4
+ ml_tools/GUI_tools.py,sha256=YlV_hkBHef5W7cw905SC4drfLDflkGvukjAiFlXHtZs,44448
5
5
  ml_tools/MICE_imputation.py,sha256=7CDsIQxx5Jb_DwPAmWmz3FXcn85sUyH7g9UcZ1_E07s,11412
6
6
  ml_tools/ML_callbacks.py,sha256=g_9nSzoA22UJOQZCPKeDz-Ayh0ECFZLzRd6rZ8SokrE,13080
7
7
  ml_tools/ML_evaluation.py,sha256=oiDV6HItQloUUKCUpltV-2pogubWLBieGpc-VUwosAQ,10106
@@ -20,7 +20,7 @@ ml_tools/keys.py,sha256=3YVbcYARSjE3vKr_6PavJSf7vXvlos7szu3qva4T3Ts,781
20
20
  ml_tools/logger.py,sha256=UkbiU9ihBhw9VKyn3rZzisdClWV94EBV6B09_D0iUU0,6026
21
21
  ml_tools/path_manager.py,sha256=1LD9JFzqVyJQl2kTA7tK930_IV3qxfiV4cMIBzItytY,8309
22
22
  ml_tools/utilities.py,sha256=Vh4ZdI03g8EpgQL7KDwnAw2vtBlHtx6KxCuAATxLvT4,24208
23
- dragon_ml_toolbox-3.12.3.dist-info/METADATA,sha256=bTM7I5KBW1RWC4Sx1KSfx9Lj5KkIOvZ47HPMVNf7S_Y,3274
24
- dragon_ml_toolbox-3.12.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
- dragon_ml_toolbox-3.12.3.dist-info/top_level.txt,sha256=wm-oxax3ciyez6VoO4zsFd-gSok2VipYXnbg3TH9PtU,9
26
- dragon_ml_toolbox-3.12.3.dist-info/RECORD,,
23
+ dragon_ml_toolbox-3.12.5.dist-info/METADATA,sha256=EZ6Q1F6Ysc2Vtfk02_2EVL6f-vxW007i0Yx5U8aRgSg,3274
24
+ dragon_ml_toolbox-3.12.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
+ dragon_ml_toolbox-3.12.5.dist-info/top_level.txt,sha256=wm-oxax3ciyez6VoO4zsFd-gSok2VipYXnbg3TH9PtU,9
26
+ dragon_ml_toolbox-3.12.5.dist-info/RECORD,,
ml_tools/GUI_tools.py CHANGED
@@ -68,7 +68,7 @@ class ConfigManager:
68
68
  if not config_path.exists():
69
69
  raise FileNotFoundError(f"Configuration file not found at: {config_path}")
70
70
 
71
- parser = configparser.ConfigParser(comment_prefixes=('#', ';'), inline_comment_prefixes=('#', ';'))
71
+ parser = configparser.ConfigParser(comment_prefixes=';', inline_comment_prefixes=';')
72
72
  parser.read(config_path)
73
73
 
74
74
  for section in parser.sections():
@@ -130,6 +130,8 @@ class ConfigManager:
130
130
  }
131
131
  config['Colors'] = {
132
132
  '; Use standard hex codes (e.g., #FFFFFF) or color names (e.g., white).': '',
133
+ '; Color for the text inside a standard input box.': '',
134
+ 'input_text': '#000000',
133
135
  '; Color for the text inside a disabled target/output box.': '',
134
136
  'target_text': '#0000D0',
135
137
  '; Background color for a disabled target/output box.': '',
@@ -216,7 +218,7 @@ class GUIFactory:
216
218
  data_dict: Dict[str, Union[Tuple[Union[int,float,None], Union[int,float,None]],List[Union[int,float,None]]]],
217
219
  is_target: bool = False,
218
220
  layout_mode: Literal["grid", "row"] = 'grid',
219
- features_per_column: int = 4
221
+ number_columns: int = 5
220
222
  ) -> List[List[sg.Column]]:
221
223
  """
222
224
  Generates a layout for continuous features or targets.
@@ -225,7 +227,7 @@ class GUIFactory:
225
227
  data_dict (dict): Keys are feature names, values are (min, max) tuples.
226
228
  is_target (bool): If True, creates disabled inputs for displaying results.
227
229
  layout_mode (str): 'grid' for a multi-row grid layout, or 'row' for a single horizontal row.
228
- features_per_column (int): Number of features per column when `layout_mode` is 'grid'.
230
+ number_columns (int): Number of columns when `layout_mode` is 'grid'.
229
231
 
230
232
  Returns:
231
233
  A list of lists of sg.Column elements, ready to be used in a window layout.
@@ -234,7 +236,7 @@ class GUIFactory:
234
236
  bg_color = sg.theme_background_color()
235
237
  label_font = (cfg.fonts.font_family, cfg.fonts.label_size, cfg.fonts.label_style) # type: ignore
236
238
 
237
- columns = []
239
+ all_feature_layouts = []
238
240
  for name, value in data_dict.items():
239
241
  if value is None:
240
242
  raise ValueError(f"Feature '{name}' was assigned a 'None' value.")
@@ -247,7 +249,11 @@ class GUIFactory:
247
249
 
248
250
  label = sg.Text(name, font=label_font, background_color=bg_color, key=f"_text_{name}")
249
251
 
250
- input_style = {"size": cfg.layout.input_size_cont, "justification": "center"} # type: ignore
252
+ input_style = {
253
+ "size": cfg.layout.input_size_cont, # type: ignore
254
+ "justification": "center",
255
+ "text_color": cfg.colors.input_text # type: ignore
256
+ }
251
257
  if is_target:
252
258
  input_style["text_color"] = cfg.colors.target_text # type: ignore
253
259
  input_style["disabled_readonly_background_color"] = cfg.colors.target_background # type: ignore
@@ -263,19 +269,19 @@ class GUIFactory:
263
269
 
264
270
  # each feature is wrapped as a column element
265
271
  layout.append([sg.Text(" ", font=(cfg.fonts.font_family, 2), background_color=bg_color)]) # type: ignore
266
- columns.append(sg.Column(layout, background_color=bg_color))
272
+ all_feature_layouts.append(sg.Column(layout, background_color=bg_color))
267
273
 
268
274
  if layout_mode == 'row':
269
- return [columns] # A single row containing all columns
275
+ return [all_feature_layouts] # A single row containing all features
270
276
 
271
- # Default to 'grid' layout
272
- return [columns[i:i + features_per_column] for i in range(0, len(columns), features_per_column)]
277
+ # Default to 'grid' layout: delegate to the helper method
278
+ return self._build_grid_layout(all_feature_layouts, number_columns, bg_color) # type: ignore
273
279
 
274
280
  def generate_combo_layout(
275
281
  self,
276
282
  data_dict: Dict[str, Union[List[Any],Tuple[Any,...]]],
277
283
  layout_mode: Literal["grid", "row"] = 'grid',
278
- features_per_column: int = 4
284
+ number_columns: int = 5
279
285
  ) -> List[List[sg.Column]]:
280
286
  """
281
287
  Generates a layout for categorical or binary features using Combo boxes.
@@ -283,7 +289,7 @@ class GUIFactory:
283
289
  Args:
284
290
  data_dict (dict): Keys are feature names, values are lists of options.
285
291
  layout_mode (str): 'grid' for a multi-row grid layout, or 'row' for a single horizontal row.
286
- features_per_column (int): Number of features per column when `layout_mode` is 'grid'.
292
+ number_columns (int): Number of columns when `layout_mode` is 'grid'.
287
293
 
288
294
  Returns:
289
295
  A list of lists of sg.Column elements, ready to be used in a window layout.
@@ -292,29 +298,30 @@ class GUIFactory:
292
298
  bg_color = sg.theme_background_color()
293
299
  label_font = (cfg.fonts.font_family, cfg.fonts.label_size, cfg.fonts.label_style) # type: ignore
294
300
 
295
- columns = []
301
+ all_feature_layouts = []
296
302
  for name, values in data_dict.items():
297
303
  label = sg.Text(name, font=label_font, background_color=bg_color, key=f"_text_{name}")
298
304
  element = sg.Combo(
299
305
  values, default_value=values[0], key=name,
300
- size=cfg.layout.input_size_binary, readonly=True # type: ignore
306
+ size=cfg.layout.input_size_binary, readonly=True, # type: ignore
307
+ text_color=cfg.colors.input_text # type: ignore
301
308
  )
302
309
  layout = [[label], [element]]
303
310
  layout.append([sg.Text(" ", font=(cfg.fonts.font_family, 2), background_color=bg_color)]) # type: ignore
304
311
  # each feature is wrapped in a Column element
305
- columns.append(sg.Column(layout, background_color=bg_color))
312
+ all_feature_layouts.append(sg.Column(layout, background_color=bg_color))
306
313
 
307
314
  if layout_mode == 'row':
308
- return [columns] # A single row containing all columns
315
+ return [all_feature_layouts] # A single row containing all features
309
316
 
310
- # Default to 'grid' layout
311
- return [columns[i:i + features_per_column] for i in range(0, len(columns), features_per_column)]
317
+ # Default to 'grid' layout: delegate to the helper method
318
+ return self._build_grid_layout(all_feature_layouts, number_columns, bg_color) # type: ignore
312
319
 
313
320
  def generate_multiselect_layout(
314
321
  self,
315
322
  data_dict: Dict[str, Union[List[Any], Tuple[Any, ...]]],
316
323
  layout_mode: Literal["grid", "row"] = 'grid',
317
- features_per_column: int = 4
324
+ number_columns: int = 5
318
325
  ) -> List[List[sg.Column]]:
319
326
  """
320
327
  Generates a layout for features using Listbox elements for multiple selections.
@@ -325,7 +332,7 @@ class GUIFactory:
325
332
  Args:
326
333
  data_dict (dict): Keys are feature names, values are lists of options.
327
334
  layout_mode (str): 'grid' for a multi-row grid layout, or 'row' for a single horizontal row.
328
- features_per_column (int): Number of features per column when `layout_mode` is 'grid'.
335
+ number_columns (int): Number of columns when `layout_mode` is 'grid'.
329
336
 
330
337
  Returns:
331
338
  A list of lists of sg.Column elements, ready to be used in a window layout.
@@ -334,7 +341,7 @@ class GUIFactory:
334
341
  bg_color = sg.theme_background_color()
335
342
  label_font = (cfg.fonts.font_family, cfg.fonts.label_size, cfg.fonts.label_style) # type: ignore
336
343
 
337
- columns = []
344
+ all_feature_layouts = []
338
345
  for name, values in data_dict.items():
339
346
  label = sg.Text(name, font=label_font, background_color=bg_color, key=f"_text_{name}")
340
347
 
@@ -344,22 +351,22 @@ class GUIFactory:
344
351
  key=name,
345
352
  select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE,
346
353
  size=cfg.layout.input_size_multi, # type: ignore
347
- no_scrollbar=False
354
+ no_scrollbar=False,
355
+ text_color=cfg.colors.input_text # type: ignore
348
356
  )
349
- # -------------------
350
357
 
351
358
  layout = [[label], [element]]
352
359
  # Add a small spacer for consistent vertical alignment.
353
360
  layout.append([sg.Text(" ", font=(cfg.fonts.font_family, 2), background_color=bg_color)]) # type: ignore
354
361
 
355
362
  # Each feature is wrapped in a Column element for proper alignment.
356
- columns.append(sg.Column(layout, background_color=bg_color))
363
+ all_feature_layouts.append(sg.Column(layout, background_color=bg_color))
357
364
 
358
365
  if layout_mode == 'row':
359
- return [columns] # A single row containing all columns
366
+ return [all_feature_layouts] # A single row containing all features
360
367
 
361
- # Default to 'grid' layout
362
- return [columns[i:i + features_per_column] for i in range(0, len(columns), features_per_column)]
368
+ # Default to 'grid' layout: delegate to the helper method
369
+ return self._build_grid_layout(all_feature_layouts, number_columns, bg_color) # type: ignore
363
370
 
364
371
  # --- Window Creation ---
365
372
  def create_window(self, title: str, layout: List[List[sg.Element]], **kwargs) -> sg.Window:
@@ -388,6 +395,24 @@ class GUIFactory:
388
395
  if cfg.max_size: window.TKroot.maxsize(*cfg.max_size)
389
396
 
390
397
  return window
398
+
399
+ def _build_grid_layout(self, all_feature_layouts: List[sg.Column], num_columns: int, bg_color: str) -> List[List[sg.Column]]:
400
+ """
401
+ Private helper to distribute feature layouts vertically into a grid of columns.
402
+ """
403
+ # Distribute features vertically into the specified number of columns
404
+ final_columns = [[] for _ in range(num_columns)]
405
+ for i, feature_layout in enumerate(all_feature_layouts):
406
+ # Use modulo to distribute features in a round-robin fashion
407
+ target_column_index = i % num_columns
408
+ final_columns[target_column_index].append(feature_layout)
409
+
410
+ # Wrap each list of features in its own sg.Column element, ensuring the
411
+ # inner layout is a list of rows [[c] for c in col].
412
+ gui_columns = [sg.Column([[c] for c in col], background_color=bg_color) for col in final_columns]
413
+
414
+ # Return a single row containing all the generated vertical columns
415
+ return [gui_columns]
391
416
 
392
417
 
393
418
  # --- Exception Handling Decorator ---