dragon-ml-toolbox 3.12.1__tar.gz → 3.12.2__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.
- {dragon_ml_toolbox-3.12.1/dragon_ml_toolbox.egg-info → dragon_ml_toolbox-3.12.2}/PKG-INFO +1 -1
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2/dragon_ml_toolbox.egg-info}/PKG-INFO +1 -1
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/GUI_tools.py +22 -3
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/keys.py +6 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/pyproject.toml +1 -1
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/LICENSE +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/LICENSE-THIRD-PARTY.md +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/README.md +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/dragon_ml_toolbox.egg-info/SOURCES.txt +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/dragon_ml_toolbox.egg-info/dependency_links.txt +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/dragon_ml_toolbox.egg-info/requires.txt +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/dragon_ml_toolbox.egg-info/top_level.txt +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/ETL_engineering.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/MICE_imputation.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/ML_callbacks.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/ML_evaluation.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/ML_trainer.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/ML_tutorial.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/PSO_optimization.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/RNN_forecast.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/VIF_factor.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/__init__.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/_pytorch_models.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/data_exploration.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/datasetmaster.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/ensemble_learning.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/handle_excel.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/logger.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/path_manager.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/ml_tools/utilities.py +0 -0
- {dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/setup.cfg +0 -0
|
@@ -7,6 +7,7 @@ from typing import Any, Dict, Tuple, List, Literal, Union, Optional, Callable
|
|
|
7
7
|
from .utilities import _script_info
|
|
8
8
|
import numpy as np
|
|
9
9
|
from .logger import _LOGGER
|
|
10
|
+
from .keys import _OneHotOtherPlaceholder
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
__all__ = [
|
|
@@ -416,7 +417,7 @@ class FeatureMaster:
|
|
|
416
417
|
|
|
417
418
|
This class serves as a centralized registry for all features and targets
|
|
418
419
|
used by a model. It is designed to bridge the gap between a user-facing
|
|
419
|
-
application (
|
|
420
|
+
application (GUI) and the underlying model's data representation.
|
|
420
421
|
|
|
421
422
|
It takes various types of features (continuous, binary, one-hot encoded,
|
|
422
423
|
categorical) and targets, processing them into two key formats:
|
|
@@ -439,7 +440,8 @@ class FeatureMaster:
|
|
|
439
440
|
binary_features: Optional[Dict[str, str]] = None,
|
|
440
441
|
multi_binary_features: Optional[Dict[str, Dict[str, str]]] = None,
|
|
441
442
|
one_hot_features: Optional[Dict[str, Dict[str, str]]] = None,
|
|
442
|
-
categorical_features: Optional[List[Tuple[str, str, Dict[str, int]]]] = None
|
|
443
|
+
categorical_features: Optional[List[Tuple[str, str, Dict[str, int]]]] = None,
|
|
444
|
+
add_one_hot_other_placeholder: bool = True) -> None:
|
|
443
445
|
"""
|
|
444
446
|
Initializes the FeatureMaster instance by processing feature and target definitions.
|
|
445
447
|
|
|
@@ -490,6 +492,9 @@ class FeatureMaster:
|
|
|
490
492
|
- `[1]` (str): The model's internal feature name.
|
|
491
493
|
- `[2]` (Dict[str, int]): A dictionary mapping the user-selectable
|
|
492
494
|
options to their corresponding integer values.
|
|
495
|
+
|
|
496
|
+
add_one_hot_other_placeholder (bool):
|
|
497
|
+
Add a placeholder for the "Other" option. Used if `drop_first` was used when making the one-hot-encoding to prevent multicollinearity.
|
|
493
498
|
"""
|
|
494
499
|
# Validation
|
|
495
500
|
if continuous_features is None and binary_features is None and one_hot_features is None and categorical_features is None and multi_binary_features is None:
|
|
@@ -526,7 +531,15 @@ class FeatureMaster:
|
|
|
526
531
|
self.has_multi_binary = False
|
|
527
532
|
|
|
528
533
|
# one-hot features
|
|
534
|
+
self._has_one_hot_other = False
|
|
529
535
|
if one_hot_features is not None:
|
|
536
|
+
# Check for add_other
|
|
537
|
+
if add_one_hot_other_placeholder:
|
|
538
|
+
self._has_one_hot_other = True
|
|
539
|
+
# update OTHER value in-place
|
|
540
|
+
for _gui_name, one_hot_dict in one_hot_features.items():
|
|
541
|
+
one_hot_dict.update(_OneHotOtherPlaceholder.OTHER_DICT)
|
|
542
|
+
|
|
530
543
|
self._one_hot_values = self._handle_one_hot_features(one_hot_features)
|
|
531
544
|
self._one_hot_mapping = one_hot_features
|
|
532
545
|
self.has_one_hot = True
|
|
@@ -861,11 +874,17 @@ class GUIHandler:
|
|
|
861
874
|
_LOGGER.error(f"No matching name for '{gui_feature}' defined as one-hot.")
|
|
862
875
|
raise e
|
|
863
876
|
else:
|
|
864
|
-
mapped_chosen_value = one_hot_mapping[chosen_value]
|
|
865
877
|
# base results mapped to 0
|
|
866
878
|
results = {model_key: 0 for model_key in one_hot_mapping.values()}
|
|
879
|
+
# get mapped key
|
|
880
|
+
mapped_chosen_value = one_hot_mapping[chosen_value]
|
|
867
881
|
# update chosen value
|
|
868
882
|
results[mapped_chosen_value] = 1
|
|
883
|
+
|
|
884
|
+
# check if OTHER was added
|
|
885
|
+
if self.master._has_one_hot_other:
|
|
886
|
+
results.pop(_OneHotOtherPlaceholder.OTHER_MODEL)
|
|
887
|
+
|
|
869
888
|
return results
|
|
870
889
|
|
|
871
890
|
def _process_categorical(self, gui_feature: str, chosen_value: str) -> Tuple[str,int]:
|
|
@@ -26,3 +26,9 @@ class ModelSaveKeys:
|
|
|
26
26
|
# Classification keys
|
|
27
27
|
CLASSIFICATION_LABEL = "label"
|
|
28
28
|
CLASSIFICATION_PROBABILITIES = "probabilities"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class _OneHotOtherPlaceholder:
|
|
32
|
+
OTHER_GUI = "OTHER"
|
|
33
|
+
OTHER_MODEL = "one hot OTHER placeholder"
|
|
34
|
+
OTHER_DICT = {OTHER_GUI: OTHER_MODEL}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/dragon_ml_toolbox.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/dragon_ml_toolbox.egg-info/requires.txt
RENAMED
|
File without changes
|
{dragon_ml_toolbox-3.12.1 → dragon_ml_toolbox-3.12.2}/dragon_ml_toolbox.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|