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.

Files changed (38) hide show
  1. {dragon_ml_toolbox-6.4.0/dragon_ml_toolbox.egg-info → dragon_ml_toolbox-6.4.1}/PKG-INFO +1 -1
  2. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1/dragon_ml_toolbox.egg-info}/PKG-INFO +1 -1
  3. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ML_inference.py +30 -13
  4. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/pyproject.toml +1 -1
  5. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/LICENSE +0 -0
  6. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/LICENSE-THIRD-PARTY.md +0 -0
  7. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/README.md +0 -0
  8. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/dragon_ml_toolbox.egg-info/SOURCES.txt +0 -0
  9. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/dragon_ml_toolbox.egg-info/dependency_links.txt +0 -0
  10. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/dragon_ml_toolbox.egg-info/requires.txt +0 -0
  11. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/dragon_ml_toolbox.egg-info/top_level.txt +0 -0
  12. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ETL_engineering.py +0 -0
  13. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/GUI_tools.py +0 -0
  14. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/MICE_imputation.py +0 -0
  15. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ML_callbacks.py +0 -0
  16. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ML_datasetmaster.py +0 -0
  17. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ML_evaluation.py +0 -0
  18. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ML_models.py +0 -0
  19. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ML_optimization.py +0 -0
  20. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ML_trainer.py +0 -0
  21. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/PSO_optimization.py +0 -0
  22. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/RNN_forecast.py +0 -0
  23. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/SQL.py +0 -0
  24. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/VIF_factor.py +0 -0
  25. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/__init__.py +0 -0
  26. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/_logger.py +0 -0
  27. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/_script_info.py +0 -0
  28. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/custom_logger.py +0 -0
  29. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/data_exploration.py +0 -0
  30. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ensemble_evaluation.py +0 -0
  31. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ensemble_inference.py +0 -0
  32. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/ensemble_learning.py +0 -0
  33. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/handle_excel.py +0 -0
  34. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/keys.py +0 -0
  35. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/optimization_tools.py +0 -0
  36. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/path_manager.py +0 -0
  37. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/ml_tools/utilities.py +0 -0
  38. {dragon_ml_toolbox-6.4.0 → dragon_ml_toolbox-6.4.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dragon-ml-toolbox
3
- Version: 6.4.0
3
+ Version: 6.4.1
4
4
  Summary: A collection of tools for data science and machine learning projects.
5
5
  Author-email: Karl Loza <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: 6.4.0
3
+ Version: 6.4.1
4
4
  Summary: A collection of tools for data science and machine learning projects.
5
5
  Author-email: Karl Loza <luigiloza@gmail.com>
6
6
  License-Expression: MIT
@@ -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
- result = handler.predict_batch_numpy(feature_vector)[PyTorchInferenceKeys.PREDICTIONS]
196
- else: # torch
197
- result = handler.predict_batch(feature_vector)[PyTorchInferenceKeys.PREDICTIONS]
198
-
199
- # Unpack single results and update result dictionary
200
- # If the original input was 1D, extract the single prediction from the array.
201
- if is_single_sample:
202
- results[handler.target_id] = result[0]
203
- else:
204
- results[handler.target_id] = result
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
- # Always use the batch method to get both labels and probabilities
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
- labels_results[handler.target_id] = labels[0]
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dragon-ml-toolbox"
3
- version = "6.4.0"
3
+ version = "6.4.1"
4
4
  description = "A collection of tools for data science and machine learning projects."
5
5
  authors = [
6
6
  { name = "Karl Loza", email = "luigiloza@gmail.com" }