dragon-ml-toolbox 3.12.4__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.4
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.4.dist-info/licenses/LICENSE,sha256=2uUFNy7D0TLgHim1K5s3DIJ4q_KvxEXVilnU20cWliY,1066
2
- dragon_ml_toolbox-3.12.4.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=H-S-6qiGQDb8SIp8KXMQRidpTRezOqBz0jaRedUlawA,43328
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.4.dist-info/METADATA,sha256=Bxg7mUA0PgndAOYuUOff1aIDYtaow3pNPk2pcfFcMCM,3274
24
- dragon_ml_toolbox-3.12.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
- dragon_ml_toolbox-3.12.4.dist-info/top_level.txt,sha256=wm-oxax3ciyez6VoO4zsFd-gSok2VipYXnbg3TH9PtU,9
26
- dragon_ml_toolbox-3.12.4.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
@@ -218,7 +218,7 @@ class GUIFactory:
218
218
  data_dict: Dict[str, Union[Tuple[Union[int,float,None], Union[int,float,None]],List[Union[int,float,None]]]],
219
219
  is_target: bool = False,
220
220
  layout_mode: Literal["grid", "row"] = 'grid',
221
- features_per_column: int = 4
221
+ number_columns: int = 5
222
222
  ) -> List[List[sg.Column]]:
223
223
  """
224
224
  Generates a layout for continuous features or targets.
@@ -227,7 +227,7 @@ class GUIFactory:
227
227
  data_dict (dict): Keys are feature names, values are (min, max) tuples.
228
228
  is_target (bool): If True, creates disabled inputs for displaying results.
229
229
  layout_mode (str): 'grid' for a multi-row grid layout, or 'row' for a single horizontal row.
230
- 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'.
231
231
 
232
232
  Returns:
233
233
  A list of lists of sg.Column elements, ready to be used in a window layout.
@@ -236,7 +236,7 @@ class GUIFactory:
236
236
  bg_color = sg.theme_background_color()
237
237
  label_font = (cfg.fonts.font_family, cfg.fonts.label_size, cfg.fonts.label_style) # type: ignore
238
238
 
239
- columns = []
239
+ all_feature_layouts = []
240
240
  for name, value in data_dict.items():
241
241
  if value is None:
242
242
  raise ValueError(f"Feature '{name}' was assigned a 'None' value.")
@@ -269,19 +269,19 @@ class GUIFactory:
269
269
 
270
270
  # each feature is wrapped as a column element
271
271
  layout.append([sg.Text(" ", font=(cfg.fonts.font_family, 2), background_color=bg_color)]) # type: ignore
272
- columns.append(sg.Column(layout, background_color=bg_color))
272
+ all_feature_layouts.append(sg.Column(layout, background_color=bg_color))
273
273
 
274
274
  if layout_mode == 'row':
275
- return [columns] # A single row containing all columns
275
+ return [all_feature_layouts] # A single row containing all features
276
276
 
277
- # Default to 'grid' layout
278
- 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
279
279
 
280
280
  def generate_combo_layout(
281
281
  self,
282
282
  data_dict: Dict[str, Union[List[Any],Tuple[Any,...]]],
283
283
  layout_mode: Literal["grid", "row"] = 'grid',
284
- features_per_column: int = 4
284
+ number_columns: int = 5
285
285
  ) -> List[List[sg.Column]]:
286
286
  """
287
287
  Generates a layout for categorical or binary features using Combo boxes.
@@ -289,7 +289,7 @@ class GUIFactory:
289
289
  Args:
290
290
  data_dict (dict): Keys are feature names, values are lists of options.
291
291
  layout_mode (str): 'grid' for a multi-row grid layout, or 'row' for a single horizontal row.
292
- 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'.
293
293
 
294
294
  Returns:
295
295
  A list of lists of sg.Column elements, ready to be used in a window layout.
@@ -298,7 +298,7 @@ class GUIFactory:
298
298
  bg_color = sg.theme_background_color()
299
299
  label_font = (cfg.fonts.font_family, cfg.fonts.label_size, cfg.fonts.label_style) # type: ignore
300
300
 
301
- columns = []
301
+ all_feature_layouts = []
302
302
  for name, values in data_dict.items():
303
303
  label = sg.Text(name, font=label_font, background_color=bg_color, key=f"_text_{name}")
304
304
  element = sg.Combo(
@@ -309,19 +309,19 @@ class GUIFactory:
309
309
  layout = [[label], [element]]
310
310
  layout.append([sg.Text(" ", font=(cfg.fonts.font_family, 2), background_color=bg_color)]) # type: ignore
311
311
  # each feature is wrapped in a Column element
312
- columns.append(sg.Column(layout, background_color=bg_color))
312
+ all_feature_layouts.append(sg.Column(layout, background_color=bg_color))
313
313
 
314
314
  if layout_mode == 'row':
315
- return [columns] # A single row containing all columns
315
+ return [all_feature_layouts] # A single row containing all features
316
316
 
317
- # Default to 'grid' layout
318
- 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
319
319
 
320
320
  def generate_multiselect_layout(
321
321
  self,
322
322
  data_dict: Dict[str, Union[List[Any], Tuple[Any, ...]]],
323
323
  layout_mode: Literal["grid", "row"] = 'grid',
324
- features_per_column: int = 4
324
+ number_columns: int = 5
325
325
  ) -> List[List[sg.Column]]:
326
326
  """
327
327
  Generates a layout for features using Listbox elements for multiple selections.
@@ -332,7 +332,7 @@ class GUIFactory:
332
332
  Args:
333
333
  data_dict (dict): Keys are feature names, values are lists of options.
334
334
  layout_mode (str): 'grid' for a multi-row grid layout, or 'row' for a single horizontal row.
335
- 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'.
336
336
 
337
337
  Returns:
338
338
  A list of lists of sg.Column elements, ready to be used in a window layout.
@@ -341,7 +341,7 @@ class GUIFactory:
341
341
  bg_color = sg.theme_background_color()
342
342
  label_font = (cfg.fonts.font_family, cfg.fonts.label_size, cfg.fonts.label_style) # type: ignore
343
343
 
344
- columns = []
344
+ all_feature_layouts = []
345
345
  for name, values in data_dict.items():
346
346
  label = sg.Text(name, font=label_font, background_color=bg_color, key=f"_text_{name}")
347
347
 
@@ -360,13 +360,13 @@ class GUIFactory:
360
360
  layout.append([sg.Text(" ", font=(cfg.fonts.font_family, 2), background_color=bg_color)]) # type: ignore
361
361
 
362
362
  # Each feature is wrapped in a Column element for proper alignment.
363
- columns.append(sg.Column(layout, background_color=bg_color))
363
+ all_feature_layouts.append(sg.Column(layout, background_color=bg_color))
364
364
 
365
365
  if layout_mode == 'row':
366
- return [columns] # A single row containing all columns
366
+ return [all_feature_layouts] # A single row containing all features
367
367
 
368
- # Default to 'grid' layout
369
- 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
370
370
 
371
371
  # --- Window Creation ---
372
372
  def create_window(self, title: str, layout: List[List[sg.Element]], **kwargs) -> sg.Window:
@@ -395,6 +395,24 @@ class GUIFactory:
395
395
  if cfg.max_size: window.TKroot.maxsize(*cfg.max_size)
396
396
 
397
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]
398
416
 
399
417
 
400
418
  # --- Exception Handling Decorator ---