dragon-ml-toolbox 10.6.0__tar.gz → 10.7.0__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.
- {dragon_ml_toolbox-10.6.0/dragon_ml_toolbox.egg-info → dragon_ml_toolbox-10.7.0}/PKG-INFO +1 -1
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0/dragon_ml_toolbox.egg-info}/PKG-INFO +1 -1
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/ML_datasetmaster.py +25 -5
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/ML_scaler.py +1 -1
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/ML_trainer.py +3 -7
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/keys.py +2 -2
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/pyproject.toml +1 -1
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/LICENSE +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/LICENSE-THIRD-PARTY.md +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/README.md +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/dragon_ml_toolbox.egg-info/SOURCES.txt +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/dragon_ml_toolbox.egg-info/dependency_links.txt +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/dragon_ml_toolbox.egg-info/requires.txt +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/dragon_ml_toolbox.egg-info/top_level.txt +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/ETL_cleaning.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/ETL_engineering.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/GUI_tools.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/MICE_imputation.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/ML_callbacks.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/ML_evaluation.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/ML_evaluation_multi.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/ML_inference.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/ML_models.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/ML_optimization.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/PSO_optimization.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/RNN_forecast.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/SQL.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/VIF_factor.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/__init__.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/_logger.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/_script_info.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/custom_logger.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/data_exploration.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/ensemble_evaluation.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/ensemble_inference.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/ensemble_learning.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/handle_excel.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/optimization_tools.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/path_manager.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/ml_tools/utilities.py +0 -0
- {dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/setup.cfg +0 -0
|
@@ -34,7 +34,9 @@ class _PytorchDataset(Dataset):
|
|
|
34
34
|
def __init__(self, features: Union[numpy.ndarray, pandas.DataFrame],
|
|
35
35
|
labels: Union[numpy.ndarray, pandas.Series],
|
|
36
36
|
labels_dtype: torch.dtype,
|
|
37
|
-
features_dtype: torch.dtype = torch.float32
|
|
37
|
+
features_dtype: torch.dtype = torch.float32,
|
|
38
|
+
feature_names: Optional[List[str]] = None,
|
|
39
|
+
target_names: Optional[List[str]] = None):
|
|
38
40
|
"""
|
|
39
41
|
integer labels for classification.
|
|
40
42
|
|
|
@@ -50,12 +52,30 @@ class _PytorchDataset(Dataset):
|
|
|
50
52
|
self.labels = torch.tensor(labels, dtype=labels_dtype)
|
|
51
53
|
else:
|
|
52
54
|
self.labels = torch.tensor(labels.values, dtype=labels_dtype)
|
|
55
|
+
|
|
56
|
+
self._feature_names = feature_names
|
|
57
|
+
self._target_names = target_names
|
|
53
58
|
|
|
54
59
|
def __len__(self):
|
|
55
60
|
return len(self.features)
|
|
56
61
|
|
|
57
62
|
def __getitem__(self, index):
|
|
58
63
|
return self.features[index], self.labels[index]
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def feature_names(self):
|
|
67
|
+
if self._feature_names is not None:
|
|
68
|
+
return self._feature_names
|
|
69
|
+
else:
|
|
70
|
+
_LOGGER.error(f"Dataset {self.__class__} has not been initialized with any feature names.")
|
|
71
|
+
raise ValueError()
|
|
72
|
+
|
|
73
|
+
@property
|
|
74
|
+
def target_names(self):
|
|
75
|
+
if self._target_names is not None:
|
|
76
|
+
return self._target_names
|
|
77
|
+
else:
|
|
78
|
+
_LOGGER.error(f"Dataset {self.__class__} has not been initialized with any target names.")
|
|
59
79
|
|
|
60
80
|
|
|
61
81
|
# --- Abstract Base Class (New) ---
|
|
@@ -229,8 +249,8 @@ class DatasetMaker(_BaseDatasetMaker):
|
|
|
229
249
|
)
|
|
230
250
|
|
|
231
251
|
# --- 4. Create Datasets ---
|
|
232
|
-
self._train_ds = _PytorchDataset(X_train_final, y_train.values, label_dtype)
|
|
233
|
-
self._test_ds = _PytorchDataset(X_test_final, y_test.values, label_dtype)
|
|
252
|
+
self._train_ds = _PytorchDataset(X_train_final, y_train.values, labels_dtype=label_dtype, feature_names=self._feature_names, target_names=[self._target_name])
|
|
253
|
+
self._test_ds = _PytorchDataset(X_test_final, y_test.values, labels_dtype=label_dtype, feature_names=self._feature_names, target_names=[self._target_name])
|
|
234
254
|
|
|
235
255
|
@property
|
|
236
256
|
def target_name(self) -> str:
|
|
@@ -280,8 +300,8 @@ class DatasetMakerMulti(_BaseDatasetMaker):
|
|
|
280
300
|
X_train, y_train, X_test, label_dtype, continuous_feature_columns
|
|
281
301
|
)
|
|
282
302
|
|
|
283
|
-
self._train_ds = _PytorchDataset(X_train_final, y_train, label_dtype)
|
|
284
|
-
self._test_ds = _PytorchDataset(X_test_final, y_test, label_dtype)
|
|
303
|
+
self._train_ds = _PytorchDataset(X_train_final, y_train, labels_dtype=label_dtype, feature_names=self._feature_names, target_names=self._target_names)
|
|
304
|
+
self._test_ds = _PytorchDataset(X_test_final, y_test, labels_dtype=label_dtype, feature_names=self._feature_names, target_names=self._target_names)
|
|
285
305
|
|
|
286
306
|
@property
|
|
287
307
|
def target_names(self) -> list[str]:
|
|
@@ -156,7 +156,7 @@ class PytorchScaler:
|
|
|
156
156
|
Args:
|
|
157
157
|
filepath (str | Path): The path to save the file.
|
|
158
158
|
"""
|
|
159
|
-
path_obj = make_fullpath(filepath)
|
|
159
|
+
path_obj = make_fullpath(filepath, make=True, enforce="file")
|
|
160
160
|
state = {
|
|
161
161
|
'mean': self.mean_,
|
|
162
162
|
'std': self.std_,
|
|
@@ -357,7 +357,7 @@ class MLTrainer:
|
|
|
357
357
|
If None, the trainer's test dataset is used.
|
|
358
358
|
n_samples (int): The number of samples to use for both background and explanation.
|
|
359
359
|
feature_names (list[str] | None): Feature names.
|
|
360
|
-
target_names (list[str] | None): Target names
|
|
360
|
+
target_names (list[str] | None): Target names for multi-target tasks.
|
|
361
361
|
save_dir (str | Path): Directory to save all SHAP artifacts.
|
|
362
362
|
"""
|
|
363
363
|
# Internal helper to create a dataloader and get a random sample
|
|
@@ -408,12 +408,8 @@ class MLTrainer:
|
|
|
408
408
|
if hasattr(target_dataset, "feature_names"):
|
|
409
409
|
feature_names = target_dataset.feature_names # type: ignore
|
|
410
410
|
else:
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
feature_names = target_dataset.dataset.feature_names # type: ignore
|
|
414
|
-
except AttributeError:
|
|
415
|
-
_LOGGER.error("Could not extract `feature_names` from the dataset. It must be provided if the dataset object does not have a `feature_names` attribute.")
|
|
416
|
-
raise ValueError()
|
|
411
|
+
_LOGGER.error("Could not extract `feature_names` from the dataset. It must be provided if the dataset object does not have a `feature_names` attribute.")
|
|
412
|
+
raise ValueError()
|
|
417
413
|
|
|
418
414
|
# 3. Call the plotting function
|
|
419
415
|
if self.kind in ["regression", "classification"]:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/dragon_ml_toolbox.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/dragon_ml_toolbox.egg-info/requires.txt
RENAMED
|
File without changes
|
{dragon_ml_toolbox-10.6.0 → dragon_ml_toolbox-10.7.0}/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|