dragon-ml-toolbox 12.9.0__tar.gz → 12.9.1__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.
Files changed (46) hide show
  1. {dragon_ml_toolbox-12.9.0/dragon_ml_toolbox.egg-info → dragon_ml_toolbox-12.9.1}/PKG-INFO +1 -1
  2. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1/dragon_ml_toolbox.egg-info}/PKG-INFO +1 -1
  3. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/data_exploration.py +13 -6
  4. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/pyproject.toml +1 -1
  5. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/LICENSE +0 -0
  6. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/LICENSE-THIRD-PARTY.md +0 -0
  7. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/README.md +0 -0
  8. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/dragon_ml_toolbox.egg-info/SOURCES.txt +0 -0
  9. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/dragon_ml_toolbox.egg-info/dependency_links.txt +0 -0
  10. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/dragon_ml_toolbox.egg-info/requires.txt +0 -0
  11. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/dragon_ml_toolbox.egg-info/top_level.txt +0 -0
  12. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ETL_cleaning.py +0 -0
  13. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ETL_engineering.py +0 -0
  14. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/GUI_tools.py +0 -0
  15. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/MICE_imputation.py +0 -0
  16. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ML_callbacks.py +0 -0
  17. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ML_datasetmaster.py +0 -0
  18. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ML_evaluation.py +0 -0
  19. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ML_evaluation_multi.py +0 -0
  20. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ML_inference.py +0 -0
  21. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ML_models.py +0 -0
  22. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ML_optimization.py +0 -0
  23. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ML_scaler.py +0 -0
  24. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ML_simple_optimization.py +0 -0
  25. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ML_trainer.py +0 -0
  26. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ML_utilities.py +0 -0
  27. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/PSO_optimization.py +0 -0
  28. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/RNN_forecast.py +0 -0
  29. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/SQL.py +0 -0
  30. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/VIF_factor.py +0 -0
  31. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/__init__.py +0 -0
  32. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/_logger.py +0 -0
  33. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/_script_info.py +0 -0
  34. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/constants.py +0 -0
  35. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/custom_logger.py +0 -0
  36. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ensemble_evaluation.py +0 -0
  37. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ensemble_inference.py +0 -0
  38. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/ensemble_learning.py +0 -0
  39. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/handle_excel.py +0 -0
  40. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/keys.py +0 -0
  41. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/math_utilities.py +0 -0
  42. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/optimization_tools.py +0 -0
  43. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/path_manager.py +0 -0
  44. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/serde.py +0 -0
  45. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/ml_tools/utilities.py +0 -0
  46. {dragon_ml_toolbox-12.9.0 → dragon_ml_toolbox-12.9.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dragon-ml-toolbox
3
- Version: 12.9.0
3
+ Version: 12.9.1
4
4
  Summary: A collection of tools for data science and machine learning projects.
5
5
  Author-email: "Karl L. Loza Vidaurre" <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: 12.9.0
3
+ Version: 12.9.1
4
4
  Summary: A collection of tools for data science and machine learning projects.
5
5
  Author-email: "Karl L. Loza Vidaurre" <luigiloza@gmail.com>
6
6
  License-Expression: MIT
@@ -364,7 +364,6 @@ def encode_categorical_features(
364
364
  - If True, encodes Null values as a distinct category 'null_label' with a value of 0. Other categories start from 1.
365
365
  - If False, Nulls are ignored and categories start from 0.
366
366
 
367
-
368
367
  null_label (str): Category to encode Nulls to if `encode_nulls` is True. If a name collision with `null_label` occurs, the fallback key will be "__NULL__".
369
368
  split_resulting_dataset (bool):
370
369
  - If True, returns two separate DataFrames, one with non-categorical columns and one with the encoded columns.
@@ -1025,6 +1024,7 @@ def reconstruct_one_hot(
1025
1024
  df: pd.DataFrame,
1026
1025
  features_to_reconstruct: List[Union[str, Tuple[str, Optional[str]]]],
1027
1026
  separator: str = '_',
1027
+ baseline_category_name: str = "Other",
1028
1028
  drop_original: bool = True,
1029
1029
  verbose: bool = True
1030
1030
  ) -> pd.DataFrame:
@@ -1042,19 +1042,22 @@ def reconstruct_one_hot(
1042
1042
  A list defining the features to reconstruct. This list can contain:
1043
1043
 
1044
1044
  - A string: (e.g., "Color")
1045
- This reconstructs the feature 'Color' and assumes all-zero rows represent missing data NaN.
1045
+ This reconstructs the feature 'Color' and assumes all-zero rows represent the baseline category ("Other" by default).
1046
1046
  - A tuple: (e.g., ("Pet", "Dog"))
1047
- This reconstructs 'Pet' and maps all-zero rows to the baseline category "Dog" (handling 'drop_first=True' scenarios).
1047
+ This reconstructs 'Pet' and maps all-zero rows to the baseline category "Dog".
1048
1048
  - A tuple with None: (e.g., ("Size", None))
1049
- This is explicit and behaves identically to just passing "Size". All-zero rows will be mapped to NaN.
1049
+ This reconstructs 'Size' and maps all-zero rows to the NaN value.
1050
1050
  Example:
1051
1051
  [
1052
- "Mood", # All-zeros -> NaN
1052
+ "Mood", # All-zeros -> "Other"
1053
1053
  ("Color", "Red"), # All-zeros -> "Red"
1054
+ ("Size", None) # All-zeros -> NaN
1054
1055
  ]
1055
1056
  separator (str):
1056
1057
  The character separating the base name from the categorical value in
1057
1058
  the column names (e.g., '_' in 'B_a').
1059
+ baseline_category_name (str):
1060
+ The baseline category name to use by default if it is not explicitly provided.
1058
1061
  drop_original (bool):
1059
1062
  If True, the original one-hot encoded columns will be dropped from
1060
1063
  the returned DataFrame.
@@ -1077,6 +1080,10 @@ def reconstruct_one_hot(
1077
1080
  if not isinstance(df, pd.DataFrame):
1078
1081
  _LOGGER.error("Input must be a pandas DataFrame.")
1079
1082
  raise TypeError()
1083
+
1084
+ if not isinstance(baseline_category_name, str):
1085
+ _LOGGER.error("The baseline_category must be a string.")
1086
+ raise TypeError()
1080
1087
 
1081
1088
  new_df = df.copy()
1082
1089
  all_ohe_cols_to_drop = []
@@ -1090,7 +1097,7 @@ def reconstruct_one_hot(
1090
1097
  if isinstance(item, str):
1091
1098
  # Case 1: "Color"
1092
1099
  base_name = item
1093
- baseline_val = None
1100
+ baseline_val = baseline_category_name
1094
1101
  elif isinstance(item, tuple) and len(item) == 2:
1095
1102
  # Case 2: ("Pet", "dog") or ("Size", None)
1096
1103
  base_name, baseline_val = item
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dragon-ml-toolbox"
3
- version = "12.9.0"
3
+ version = "12.9.1"
4
4
  description = "A collection of tools for data science and machine learning projects."
5
5
  authors = [
6
6
  { name = "Karl L. Loza Vidaurre", email = "luigiloza@gmail.com" }