dragon-ml-toolbox 3.12.4__tar.gz → 3.12.6__tar.gz

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.

Files changed (31) hide show
  1. {dragon_ml_toolbox-3.12.4/dragon_ml_toolbox.egg-info → dragon_ml_toolbox-3.12.6}/PKG-INFO +1 -1
  2. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6/dragon_ml_toolbox.egg-info}/PKG-INFO +1 -1
  3. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/GUI_tools.py +57 -23
  4. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/pyproject.toml +1 -1
  5. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/LICENSE +0 -0
  6. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/LICENSE-THIRD-PARTY.md +0 -0
  7. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/README.md +0 -0
  8. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/dragon_ml_toolbox.egg-info/SOURCES.txt +0 -0
  9. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/dragon_ml_toolbox.egg-info/dependency_links.txt +0 -0
  10. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/dragon_ml_toolbox.egg-info/requires.txt +0 -0
  11. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/dragon_ml_toolbox.egg-info/top_level.txt +0 -0
  12. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/ETL_engineering.py +0 -0
  13. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/MICE_imputation.py +0 -0
  14. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/ML_callbacks.py +0 -0
  15. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/ML_evaluation.py +0 -0
  16. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/ML_trainer.py +0 -0
  17. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/ML_tutorial.py +0 -0
  18. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/PSO_optimization.py +0 -0
  19. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/RNN_forecast.py +0 -0
  20. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/VIF_factor.py +0 -0
  21. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/__init__.py +0 -0
  22. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/_pytorch_models.py +0 -0
  23. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/data_exploration.py +0 -0
  24. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/datasetmaster.py +0 -0
  25. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/ensemble_learning.py +0 -0
  26. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/handle_excel.py +0 -0
  27. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/keys.py +0 -0
  28. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/logger.py +0 -0
  29. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/path_manager.py +0 -0
  30. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/ml_tools/utilities.py +0 -0
  31. {dragon_ml_toolbox-3.12.4 → dragon_ml_toolbox-3.12.6}/setup.cfg +0 -0
@@ -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.6
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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dragon-ml-toolbox
3
- Version: 3.12.4
3
+ Version: 3.12.6
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
@@ -191,13 +191,14 @@ class GUIFactory:
191
191
  }
192
192
  return sg.Button(text.title(), key=key, **style_args)
193
193
 
194
- def make_frame(self, title: str, layout: List[List[Union[sg.Element, sg.Column]]], **kwargs) -> sg.Frame:
194
+ def make_frame(self, title: str, layout: List[List[Union[sg.Element, sg.Column]]], center_layout: bool = False, **kwargs) -> sg.Frame:
195
195
  """
196
196
  Creates a styled frame around a given layout.
197
197
 
198
198
  Args:
199
199
  title (str): The title displayed on the frame's border.
200
200
  layout (list): The layout to enclose within the frame.
201
+ center_layout (bool): If True, the content within the frame will be horizontally centered.
201
202
  **kwargs: Override default styles or add other sg.Frame parameters
202
203
  (e.g., `title_color='red'`, `relief=sg.RELIEF_SUNKEN`).
203
204
  """
@@ -210,6 +211,10 @@ class GUIFactory:
210
211
  "background_color": sg.theme_background_color(),
211
212
  **kwargs
212
213
  }
214
+
215
+ if center_layout:
216
+ style_args["element_justification"] = 'center'
217
+
213
218
  return sg.Frame(title, layout, **style_args)
214
219
 
215
220
  # --- General-Purpose Layout Generators ---
@@ -218,7 +223,8 @@ class GUIFactory:
218
223
  data_dict: Dict[str, Union[Tuple[Union[int,float,None], Union[int,float,None]],List[Union[int,float,None]]]],
219
224
  is_target: bool = False,
220
225
  layout_mode: Literal["grid", "row"] = 'grid',
221
- features_per_column: int = 4
226
+ number_columns: int = 5,
227
+ center_layout: bool = True
222
228
  ) -> List[List[sg.Column]]:
223
229
  """
224
230
  Generates a layout for continuous features or targets.
@@ -227,7 +233,8 @@ class GUIFactory:
227
233
  data_dict (dict): Keys are feature names, values are (min, max) tuples.
228
234
  is_target (bool): If True, creates disabled inputs for displaying results.
229
235
  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'.
236
+ number_columns (int): Number of columns when `layout_mode` is 'grid'.
237
+ center_layout (bool): If True, the entire grid will be horizontally centered.
231
238
 
232
239
  Returns:
233
240
  A list of lists of sg.Column elements, ready to be used in a window layout.
@@ -236,7 +243,7 @@ class GUIFactory:
236
243
  bg_color = sg.theme_background_color()
237
244
  label_font = (cfg.fonts.font_family, cfg.fonts.label_size, cfg.fonts.label_style) # type: ignore
238
245
 
239
- columns = []
246
+ all_feature_layouts = []
240
247
  for name, value in data_dict.items():
241
248
  if value is None:
242
249
  raise ValueError(f"Feature '{name}' was assigned a 'None' value.")
@@ -264,24 +271,25 @@ class GUIFactory:
264
271
  layout = [[label], [element]]
265
272
  else:
266
273
  range_font = (cfg.fonts.font_family, cfg.fonts.range_size) # type: ignore
267
- range_text = sg.Text(f"Range: {val_min}-{val_max}", font=range_font, background_color=bg_color) # type: ignore
274
+ range_text = sg.Text(f"Range: {val_min} - {val_max}", font=range_font, background_color=bg_color) # type: ignore
268
275
  layout = [[label], [element], [range_text]]
269
276
 
270
277
  # each feature is wrapped as a column element
271
278
  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))
279
+ all_feature_layouts.append(sg.Column(layout, background_color=bg_color))
273
280
 
274
281
  if layout_mode == 'row':
275
- return [columns] # A single row containing all columns
282
+ return [all_feature_layouts] # A single row containing all features
276
283
 
277
- # Default to 'grid' layout
278
- return [columns[i:i + features_per_column] for i in range(0, len(columns), features_per_column)]
284
+ # Default to 'grid' layout: delegate to the helper method
285
+ return self._build_grid_layout(all_feature_layouts, number_columns, bg_color, center_layout) # type: ignore
279
286
 
280
287
  def generate_combo_layout(
281
288
  self,
282
289
  data_dict: Dict[str, Union[List[Any],Tuple[Any,...]]],
283
290
  layout_mode: Literal["grid", "row"] = 'grid',
284
- features_per_column: int = 4
291
+ number_columns: int = 5,
292
+ center_layout: bool = True
285
293
  ) -> List[List[sg.Column]]:
286
294
  """
287
295
  Generates a layout for categorical or binary features using Combo boxes.
@@ -289,7 +297,8 @@ class GUIFactory:
289
297
  Args:
290
298
  data_dict (dict): Keys are feature names, values are lists of options.
291
299
  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'.
300
+ number_columns (int): Number of columns when `layout_mode` is 'grid'.
301
+ center_layout (bool): If True, the entire grid will be horizontally centered.
293
302
 
294
303
  Returns:
295
304
  A list of lists of sg.Column elements, ready to be used in a window layout.
@@ -298,7 +307,7 @@ class GUIFactory:
298
307
  bg_color = sg.theme_background_color()
299
308
  label_font = (cfg.fonts.font_family, cfg.fonts.label_size, cfg.fonts.label_style) # type: ignore
300
309
 
301
- columns = []
310
+ all_feature_layouts = []
302
311
  for name, values in data_dict.items():
303
312
  label = sg.Text(name, font=label_font, background_color=bg_color, key=f"_text_{name}")
304
313
  element = sg.Combo(
@@ -309,19 +318,20 @@ class GUIFactory:
309
318
  layout = [[label], [element]]
310
319
  layout.append([sg.Text(" ", font=(cfg.fonts.font_family, 2), background_color=bg_color)]) # type: ignore
311
320
  # each feature is wrapped in a Column element
312
- columns.append(sg.Column(layout, background_color=bg_color))
321
+ all_feature_layouts.append(sg.Column(layout, background_color=bg_color))
313
322
 
314
323
  if layout_mode == 'row':
315
- return [columns] # A single row containing all columns
324
+ return [all_feature_layouts] # A single row containing all features
316
325
 
317
- # Default to 'grid' layout
318
- return [columns[i:i + features_per_column] for i in range(0, len(columns), features_per_column)]
326
+ # Default to 'grid' layout: delegate to the helper method
327
+ return self._build_grid_layout(all_feature_layouts, number_columns, bg_color, center_layout) # type: ignore
319
328
 
320
329
  def generate_multiselect_layout(
321
330
  self,
322
331
  data_dict: Dict[str, Union[List[Any], Tuple[Any, ...]]],
323
332
  layout_mode: Literal["grid", "row"] = 'grid',
324
- features_per_column: int = 4
333
+ number_columns: int = 5,
334
+ center_layout: bool = True
325
335
  ) -> List[List[sg.Column]]:
326
336
  """
327
337
  Generates a layout for features using Listbox elements for multiple selections.
@@ -332,7 +342,8 @@ class GUIFactory:
332
342
  Args:
333
343
  data_dict (dict): Keys are feature names, values are lists of options.
334
344
  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'.
345
+ number_columns (int): Number of columns when `layout_mode` is 'grid'.
346
+ center_layout (bool): If True, the entire grid will be horizontally centered.
336
347
 
337
348
  Returns:
338
349
  A list of lists of sg.Column elements, ready to be used in a window layout.
@@ -341,7 +352,7 @@ class GUIFactory:
341
352
  bg_color = sg.theme_background_color()
342
353
  label_font = (cfg.fonts.font_family, cfg.fonts.label_size, cfg.fonts.label_style) # type: ignore
343
354
 
344
- columns = []
355
+ all_feature_layouts = []
345
356
  for name, values in data_dict.items():
346
357
  label = sg.Text(name, font=label_font, background_color=bg_color, key=f"_text_{name}")
347
358
 
@@ -360,13 +371,13 @@ class GUIFactory:
360
371
  layout.append([sg.Text(" ", font=(cfg.fonts.font_family, 2), background_color=bg_color)]) # type: ignore
361
372
 
362
373
  # Each feature is wrapped in a Column element for proper alignment.
363
- columns.append(sg.Column(layout, background_color=bg_color))
374
+ all_feature_layouts.append(sg.Column(layout, background_color=bg_color))
364
375
 
365
376
  if layout_mode == 'row':
366
- return [columns] # A single row containing all columns
377
+ return [all_feature_layouts] # A single row containing all features
367
378
 
368
- # Default to 'grid' layout
369
- return [columns[i:i + features_per_column] for i in range(0, len(columns), features_per_column)]
379
+ # Default to 'grid' layout: delegate to the helper method
380
+ return self._build_grid_layout(all_feature_layouts, number_columns, bg_color, center_layout) # type: ignore
370
381
 
371
382
  # --- Window Creation ---
372
383
  def create_window(self, title: str, layout: List[List[sg.Element]], **kwargs) -> sg.Window:
@@ -395,6 +406,29 @@ class GUIFactory:
395
406
  if cfg.max_size: window.TKroot.maxsize(*cfg.max_size)
396
407
 
397
408
  return window
409
+
410
+ def _build_grid_layout(self, all_feature_layouts: List[sg.Column], num_columns: int, bg_color: str, center_layout: bool = True) -> List[List[sg.Column]]:
411
+ """
412
+ Private helper to distribute feature layouts vertically into a grid of columns.
413
+ """
414
+ # Distribute features vertically into the specified number of columns
415
+ final_columns = [[] for _ in range(num_columns)]
416
+ for i, feature_layout in enumerate(all_feature_layouts):
417
+ # Use modulo to distribute features in a round-robin fashion
418
+ target_column_index = i % num_columns
419
+ final_columns[target_column_index].append(feature_layout)
420
+
421
+ # Wrap each list of features in its own sg.Column element, ensuring the
422
+ # inner layout is a list of rows [[c] for c in col].
423
+ gui_columns = [sg.Column([[c] for c in col], background_color=bg_color) for col in final_columns]
424
+
425
+ # Return a single row containing all the generated vertical columns
426
+ if center_layout:
427
+ # Return a single row containing the columns, centered with Push elements.
428
+ return [[sg.Push()] + gui_columns + [sg.Push()]] # type: ignore
429
+ else:
430
+ # Return a single row containing just the columns.
431
+ return [gui_columns]
398
432
 
399
433
 
400
434
  # --- Exception Handling Decorator ---
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dragon-ml-toolbox"
3
- version = "3.12.4"
3
+ version = "3.12.6"
4
4
  description = "A collection of tools for data science and machine learning projects."
5
5
  authors = [
6
6
  { name = "Karl Loza", email = "luigiloza@gmail.com" }