dragon-ml-toolbox 6.4.0__tar.gz → 6.4.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.
Potentially problematic release.
This version of dragon-ml-toolbox might be problematic. Click here for more details.
- {dragon_ml_toolbox-6.4.0/dragon_ml_toolbox.egg-info → dragon_ml_toolbox-6.4.1}/PKG-INFO +1 -1
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1/dragon_ml_toolbox.egg-info}/PKG-INFO +1 -1
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ML_inference.py +30 -13
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/pyproject.toml +1 -1
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/LICENSE +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/LICENSE-THIRD-PARTY.md +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/README.md +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/dragon_ml_toolbox.egg-info/SOURCES.txt +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/dragon_ml_toolbox.egg-info/dependency_links.txt +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/dragon_ml_toolbox.egg-info/requires.txt +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/dragon_ml_toolbox.egg-info/top_level.txt +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ETL_engineering.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/GUI_tools.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/MICE_imputation.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ML_callbacks.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ML_datasetmaster.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ML_evaluation.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ML_models.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ML_optimization.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ML_trainer.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/PSO_optimization.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/RNN_forecast.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/SQL.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/VIF_factor.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/__init__.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/_logger.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/_script_info.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/custom_logger.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/data_exploration.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ensemble_evaluation.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ensemble_inference.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ensemble_learning.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/handle_excel.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/keys.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/optimization_tools.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/path_manager.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/utilities.py +0 -0
- {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/setup.cfg +0 -0
|
@@ -190,18 +190,27 @@ def multi_inference_regression(handlers: list[PyTorchInferenceHandler],
|
|
|
190
190
|
f"Invalid task type: The handler for target_id '{handler.target_id}' "
|
|
191
191
|
f"is for '{handler.task}', but only 'regression' tasks are supported."
|
|
192
192
|
)
|
|
193
|
+
|
|
193
194
|
# inference
|
|
194
195
|
if output == "numpy":
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
196
|
+
# This path returns NumPy arrays or standard Python scalars
|
|
197
|
+
numpy_result = handler.predict_batch_numpy(feature_vector)[PyTorchInferenceKeys.PREDICTIONS]
|
|
198
|
+
if is_single_sample:
|
|
199
|
+
# For a single sample, convert the 1-element array to a Python scalar
|
|
200
|
+
results[handler.target_id] = numpy_result.item()
|
|
201
|
+
else:
|
|
202
|
+
# For a batch, return the full NumPy array of predictions
|
|
203
|
+
results[handler.target_id] = numpy_result
|
|
204
|
+
|
|
205
|
+
else: # output == "torch"
|
|
206
|
+
# This path returns PyTorch tensors on the model's device
|
|
207
|
+
torch_result = handler.predict_batch(feature_vector)[PyTorchInferenceKeys.PREDICTIONS]
|
|
208
|
+
if is_single_sample:
|
|
209
|
+
# For a single sample, return the 0-dim tensor
|
|
210
|
+
results[handler.target_id] = torch_result[0]
|
|
211
|
+
else:
|
|
212
|
+
# For a batch, return the full tensor of predictions
|
|
213
|
+
results[handler.target_id] = torch_result
|
|
205
214
|
|
|
206
215
|
return results
|
|
207
216
|
|
|
@@ -263,18 +272,26 @@ def multi_inference_classification(
|
|
|
263
272
|
f"is for '{handler.task}', but this function only supports 'classification'."
|
|
264
273
|
)
|
|
265
274
|
|
|
266
|
-
#
|
|
275
|
+
# Inference
|
|
267
276
|
if output == "numpy":
|
|
277
|
+
# predict_batch_numpy returns a dict of NumPy arrays
|
|
268
278
|
result = handler.predict_batch_numpy(feature_vector)
|
|
269
279
|
else: # torch
|
|
280
|
+
# predict_batch returns a dict of Torch tensors
|
|
270
281
|
result = handler.predict_batch(feature_vector)
|
|
271
282
|
|
|
272
283
|
labels = result[PyTorchInferenceKeys.LABELS]
|
|
273
284
|
probabilities = result[PyTorchInferenceKeys.PROBABILITIES]
|
|
274
285
|
|
|
275
|
-
# If the original input was 1D, unpack the single result from the batch array
|
|
276
286
|
if is_single_sample:
|
|
277
|
-
|
|
287
|
+
# For "numpy", convert the single label to a Python int scalar.
|
|
288
|
+
# For "torch", get the 0-dim tensor label.
|
|
289
|
+
if output == "numpy":
|
|
290
|
+
labels_results[handler.target_id] = labels.item()
|
|
291
|
+
else: # torch
|
|
292
|
+
labels_results[handler.target_id] = labels[0]
|
|
293
|
+
|
|
294
|
+
# The probabilities are an array/tensor of values
|
|
278
295
|
probs_results[handler.target_id] = probabilities[0]
|
|
279
296
|
else:
|
|
280
297
|
labels_results[handler.target_id] = labels
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/dragon_ml_toolbox.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/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
|