dragon-ml-toolbox 19.12.0__py3-none-any.whl → 19.12.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dragon-ml-toolbox
3
- Version: 19.12.0
3
+ Version: 19.12.1
4
4
  Summary: Complete pipelines and helper tools for data science and machine learning projects.
5
5
  Author-email: Karl Luigi Loza Vidaurre <luigiloza@gmail.com>
6
6
  License-Expression: MIT
@@ -1,5 +1,5 @@
1
- dragon_ml_toolbox-19.12.0.dist-info/licenses/LICENSE,sha256=L35WDmmLZNTlJvxF6Vy7Uy4SYNi6rCfWUqlTHpoRMoU,1081
2
- dragon_ml_toolbox-19.12.0.dist-info/licenses/LICENSE-THIRD-PARTY.md,sha256=0-HBRMMgKuwtGy6nMJZvIn1fLxhx_ksyyVB2U_iyYZU,2818
1
+ dragon_ml_toolbox-19.12.1.dist-info/licenses/LICENSE,sha256=L35WDmmLZNTlJvxF6Vy7Uy4SYNi6rCfWUqlTHpoRMoU,1081
2
+ dragon_ml_toolbox-19.12.1.dist-info/licenses/LICENSE-THIRD-PARTY.md,sha256=0-HBRMMgKuwtGy6nMJZvIn1fLxhx_ksyyVB2U_iyYZU,2818
3
3
  ml_tools/ETL_cleaning.py,sha256=cKXyRFaaFs_beAGDnQM54xnML671kq-yJEGjHafW-20,351
4
4
  ml_tools/ETL_engineering.py,sha256=cwh1FhtNdUHllUDvho-x3SIVj4KwG_rFQR6VYzWUg0U,898
5
5
  ml_tools/GUI_tools.py,sha256=O89rG8WQv6GY1DiphQjIsPzXFCQID6te7q_Sgt1iTkQ,294
@@ -54,18 +54,18 @@ ml_tools/utilities.py,sha256=dHNjGPH3Ck9V41IRFbRojE_RW6lACdxrNZz0FxI5SQY,691
54
54
  ml_tools/_core/_ETL_cleaning.py,sha256=_pTNKuapNHgWErmxvsXW-2YzCm4BaTshKV627A38RuA,28748
55
55
  ml_tools/_core/_ETL_engineering.py,sha256=JgIWrQGyNjmLrbyv5Kh0EHKBLmYlyrGKSnKRxGzxSco,57930
56
56
  ml_tools/_core/_GUI_tools.py,sha256=kpvk18Eb4vdLzo-I5mBV1yuwPXs-NJJ01rn-iCXHvIY,49079
57
- ml_tools/_core/_IO_tools.py,sha256=oWaYa_OVO-8ANVt_a9F1QPMvyOcI2yLbtq7LoVHlqek,16625
57
+ ml_tools/_core/_IO_tools.py,sha256=sEbtzDHkc9GNkXvsFS9ic038LzAW-rxXPuLwtoHXzGw,17107
58
58
  ml_tools/_core/_MICE_imputation.py,sha256=64l20duGWt93Q2MbqcWqrA1s99JPRf5AJACb1CZi2xI,21149
59
59
  ml_tools/_core/_ML_callbacks.py,sha256=T0PjptlpC75_Tp3bWIMPTYhxsMX-8z4YtDT4FJ3p8jg,27988
60
60
  ml_tools/_core/_ML_chaining_inference.py,sha256=vXUPZzuQ2yKU71kkvUsE0xPo0hN-Yu6gfnL0JbXoRjI,7783
61
61
  ml_tools/_core/_ML_chaining_utilities.py,sha256=nsYowgRbkIYuzRiHlqsM3tnC3c-8O73CY8DHUF14XL0,19248
62
- ml_tools/_core/_ML_configuration.py,sha256=hwnDCo9URsFqRCgLuFJhGTtoOqbE1XJreNY8B_3spTg,52693
62
+ ml_tools/_core/_ML_configuration.py,sha256=olRcam2s-Y5oUr8BAcmhwIBQDmaQZm2RHTv5sK2HeOU,53151
63
63
  ml_tools/_core/_ML_configuration_pytab.py,sha256=C3e4iScqdRePVDoqnic6xXMOW7DNYqpgTCeaFDyMdL4,3286
64
64
  ml_tools/_core/_ML_datasetmaster.py,sha256=yU1BMtzz6XumMWCetVACrRLk7WJQwmYhaQ-VAWu9Ots,32043
65
65
  ml_tools/_core/_ML_evaluation.py,sha256=bu8qlYzhWSC1B7wNfCC5TSF-oed-uP8EF7TV45VTiBM,37325
66
66
  ml_tools/_core/_ML_evaluation_captum.py,sha256=a69jnghIzE9qppuw2vzTBMdTErnZkDkTA3MPUUYjsS4,19212
67
67
  ml_tools/_core/_ML_evaluation_multi.py,sha256=n_AJbKF58DMUrYqJutwPFV5z6sNssDPA1Gl05IfPG5s,23647
68
- ml_tools/_core/_ML_finalize_handler.py,sha256=0eZ_0N2L5aUUIJUgvhAQ-rbd8XbE9UmNqTKSJq09uTI,6987
68
+ ml_tools/_core/_ML_finalize_handler.py,sha256=1__wG3Jcr9h1a99F-CmHezhEw1_Ojxh3aDHNyJN2S5w,7127
69
69
  ml_tools/_core/_ML_inference.py,sha256=5swm2lnsrDLalBnCm7gZPlDucX4yNCq5vn7ck3SW_4Q,29791
70
70
  ml_tools/_core/_ML_models.py,sha256=8FUx4-TVghlBF9srh1_5UxovrWPU7YEZ6XXLqwJei88,27974
71
71
  ml_tools/_core/_ML_models_advanced.py,sha256=oU6M5FEBMQ9yPp32cziWh3bz8SXRho07vFMC8ZDVcuU,45002
@@ -105,7 +105,7 @@ ml_tools/_core/_schema.py,sha256=TM5WVVMoKOvr_Bc2z34sU_gzKlM465PRKTgdZaEOkGY,140
105
105
  ml_tools/_core/_script_info.py,sha256=21r83LV3RubsNZ_RTEUON6RbDf7Mh4_udweNcvdF_Fk,212
106
106
  ml_tools/_core/_serde.py,sha256=tsI4EO2Y7jrBMmbQ1pinDsPOrOg-SaPuB-Dt40q0taE,5609
107
107
  ml_tools/_core/_utilities.py,sha256=D7FGyEszcMHxGkMW4aqN7JUwabTICCcQz9qsGtOj97o,22787
108
- dragon_ml_toolbox-19.12.0.dist-info/METADATA,sha256=MoUoxvRMHfPhedd87f68yWWlPJFEGVFCOa1OpgKwpHE,8193
109
- dragon_ml_toolbox-19.12.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
110
- dragon_ml_toolbox-19.12.0.dist-info/top_level.txt,sha256=wm-oxax3ciyez6VoO4zsFd-gSok2VipYXnbg3TH9PtU,9
111
- dragon_ml_toolbox-19.12.0.dist-info/RECORD,,
108
+ dragon_ml_toolbox-19.12.1.dist-info/METADATA,sha256=fG-Wysq1R7U4y_3OhOux_d61Gd_g857Jh009JPQKXcM,8193
109
+ dragon_ml_toolbox-19.12.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
110
+ dragon_ml_toolbox-19.12.1.dist-info/top_level.txt,sha256=wm-oxax3ciyez6VoO4zsFd-gSok2VipYXnbg3TH9PtU,9
111
+ dragon_ml_toolbox-19.12.1.dist-info/RECORD,,
@@ -434,8 +434,8 @@ def train_logger(train_config: Union[dict, Any],
434
434
  Logs training data to JSON, adding a timestamp to the filename.
435
435
 
436
436
  Args:
437
- train_config (dict | Any): Training configuration parameters.
438
- model_parameters (dict | Any): Model parameters.
437
+ train_config (dict | Any): Training configuration parameters. If object, must have a `.to_log()` method returning a dict.
438
+ model_parameters (dict | Any): Model parameters. If object, must have a `.to_log()` method returning a dict.
439
439
  train_history (dict | None): Training history log.
440
440
  save_directory (str | Path): Directory to save the log file.
441
441
  """
@@ -443,6 +443,9 @@ def train_logger(train_config: Union[dict, Any],
443
443
  if not isinstance(train_config, dict):
444
444
  if hasattr(train_config, "to_log") and callable(getattr(train_config, "to_log")):
445
445
  train_config_dict: dict = train_config.to_log()
446
+ if not isinstance(train_config_dict, dict):
447
+ _LOGGER.error("'train_config.to_log()' did not return a dictionary.")
448
+ raise ValueError()
446
449
  else:
447
450
  _LOGGER.error("'train_config' must be a dict or an object with a 'to_log()' method.")
448
451
  raise ValueError()
@@ -458,6 +461,9 @@ def train_logger(train_config: Union[dict, Any],
458
461
  if not isinstance(model_parameters, dict):
459
462
  if hasattr(model_parameters, "to_log") and callable(getattr(model_parameters, "to_log")):
460
463
  model_parameters_dict: dict = model_parameters.to_log()
464
+ if not isinstance(model_parameters_dict, dict):
465
+ _LOGGER.error("'model_parameters.to_log()' did not return a dictionary.")
466
+ raise ValueError()
461
467
  else:
462
468
  _LOGGER.error("'model_parameters' must be a dict or an object with a 'to_log()' method.")
463
469
  raise ValueError()
@@ -660,18 +660,27 @@ class DragonTrainingConfig(_BaseModelParams):
660
660
  initial_learning_rate: float,
661
661
  batch_size: int,
662
662
  random_state: int = 101,
663
- early_stop_patience: Optional[int] = None,
664
- scheduler_patience: Optional[int] = None,
665
- scheduler_lr_factor: Optional[float] = None,
663
+ # early_stop_patience: Optional[int] = None,
664
+ # scheduler_patience: Optional[int] = None,
665
+ # scheduler_lr_factor: Optional[float] = None,
666
666
  **kwargs: Any) -> None:
667
+ """
668
+ Args:
669
+ validation_size (float): Proportion of data for validation set.
670
+ test_size (float): Proportion of data for test set.
671
+ initial_learning_rate (float): Starting learning rate.
672
+ batch_size (int): Number of samples per training batch.
673
+ random_state (int): Seed for reproducibility.
674
+ **kwargs: Additional training parameters as key-value pairs.
675
+ """
667
676
  self.validation_size = validation_size
668
677
  self.test_size = test_size
669
678
  self.initial_learning_rate = initial_learning_rate
670
679
  self.batch_size = batch_size
671
680
  self.random_state = random_state
672
- self.early_stop_patience = early_stop_patience
673
- self.scheduler_patience = scheduler_patience
674
- self.scheduler_lr_factor = scheduler_lr_factor
681
+ # self.early_stop_patience = early_stop_patience
682
+ # self.scheduler_patience = scheduler_patience
683
+ # self.scheduler_lr_factor = scheduler_lr_factor
675
684
 
676
685
  # Process kwargs with validation
677
686
  for key, value in kwargs.items():
@@ -51,7 +51,7 @@ class FinalizedFileHandler:
51
51
  self._initial_sequence: Optional[np.ndarray] = None
52
52
  self._target_name: Optional[str] = None
53
53
  self._target_names: Optional[list[str]] = None
54
- self._model_state_dict: Optional[Any] = None
54
+ self._model_state_dict: Optional[dict[str, Any]] = None
55
55
 
56
56
  # Set warning outputs
57
57
  self._verbose: bool=True
@@ -90,7 +90,7 @@ class FinalizedFileHandler:
90
90
 
91
91
  else:
92
92
  # It is a dict, but missing the keys, assume it is the raw state dict
93
- _LOGGER.info(f"File '{pth_path.name}' does not have the required keys for a finalized-file. Treating it as raw PyTorch state dictionary.")
93
+ _LOGGER.warning(f"File '{pth_path.name}' does not have the required keys for a Dragon-ML finalized-file. Keys found:\n {list(pth_file_content.keys())}")
94
94
  self._model_state_dict = pth_file_content
95
95
 
96
96
 
@@ -113,9 +113,10 @@ class FinalizedFileHandler:
113
113
  return self._task
114
114
 
115
115
  @property
116
- def model_state_dict(self):
116
+ def model_state_dict(self) -> dict[str, Any]:
117
117
  """Returns the model state dictionary."""
118
- return self._model_state_dict
118
+ # No need to check for None, as it is guaranteed to be set in __init__
119
+ return self._model_state_dict # type: ignore
119
120
 
120
121
  @property
121
122
  def epoch(self) -> Optional[int]: