dragon-ml-toolbox 20.7.1__tar.gz → 20.9.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-20.7.1/dragon_ml_toolbox.egg-info → dragon_ml_toolbox-20.9.0}/PKG-INFO +3 -1
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/README.md +2 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0/dragon_ml_toolbox.egg-info}/PKG-INFO +3 -1
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/dragon_ml_toolbox.egg-info/SOURCES.txt +5 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_configuration/_metrics.py +17 -10
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_datasetmaster/_base_datasetmaster.py +53 -3
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_evaluation/_classification.py +83 -8
- dragon_ml_toolbox-20.9.0/ml_tools/ML_evaluation/_helpers.py +41 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_evaluation/_regression.py +5 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/data_exploration/__init__.py +5 -1
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/data_exploration/_analysis.py +149 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/data_exploration/_features.py +76 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/keys/_keys.py +1 -0
- dragon_ml_toolbox-20.9.0/ml_tools/resampling/__init__.py +19 -0
- dragon_ml_toolbox-20.9.0/ml_tools/resampling/_base_resampler.py +49 -0
- dragon_ml_toolbox-20.9.0/ml_tools/resampling/_multi_resampling.py +184 -0
- dragon_ml_toolbox-20.9.0/ml_tools/resampling/_single_resampling.py +113 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/pyproject.toml +1 -1
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/LICENSE +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/LICENSE-THIRD-PARTY.md +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/dragon_ml_toolbox.egg-info/dependency_links.txt +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/dragon_ml_toolbox.egg-info/requires.txt +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/dragon_ml_toolbox.egg-info/top_level.txt +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ETL_cleaning/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ETL_cleaning/_basic_clean.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ETL_cleaning/_clean_tools.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ETL_cleaning/_dragon_cleaner.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ETL_engineering/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ETL_engineering/_dragon_engineering.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ETL_engineering/_transforms.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/GUI_tools/_GUI_tools.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/GUI_tools/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/IO_tools/_IO_loggers.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/IO_tools/_IO_save_load.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/IO_tools/_IO_utils.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/IO_tools/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/MICE/_MICE_imputation.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/MICE/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/MICE/_dragon_mice.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_callbacks/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_callbacks/_base.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_callbacks/_checkpoint.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_callbacks/_early_stop.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_callbacks/_scheduler.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_chain/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_chain/_chaining_tools.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_chain/_dragon_chain.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_chain/_update_schema.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_configuration/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_configuration/_base_model_config.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_configuration/_finalize.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_configuration/_models.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_configuration/_training.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_datasetmaster/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_datasetmaster/_datasetmaster.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_datasetmaster/_sequence_datasetmaster.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_datasetmaster/_vision_datasetmaster.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_evaluation/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_evaluation/_feature_importance.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_evaluation/_loss.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_evaluation/_sequence.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_evaluation/_vision.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_evaluation_captum/_ML_evaluation_captum.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_evaluation_captum/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_finalize_handler/_ML_finalize_handler.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_finalize_handler/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_inference/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_inference/_base_inference.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_inference/_chain_inference.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_inference/_dragon_inference.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_inference/_multi_inference.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_inference_sequence/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_inference_sequence/_sequence_inference.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_inference_vision/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_inference_vision/_vision_inference.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models/_base_mlp_attention.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models/_base_save_load.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models/_dragon_autoint.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models/_dragon_gate.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models/_dragon_node.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models/_dragon_tabnet.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models/_dragon_tabular.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models/_mlp_attention.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models/_models_advanced_helpers.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models_sequence/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models_sequence/_sequence_models.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models_vision/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models_vision/_base_wrapper.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models_vision/_image_classification.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models_vision/_image_segmentation.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_models_vision/_object_detection.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_optimization/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_optimization/_multi_dragon.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_optimization/_single_dragon.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_optimization/_single_manual.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_scaler/_ML_scaler.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_scaler/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_trainer/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_trainer/_base_trainer.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_trainer/_dragon_detection_trainer.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_trainer/_dragon_sequence_trainer.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_trainer/_dragon_trainer.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_utilities/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_utilities/_artifact_finder.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_utilities/_inspection.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_utilities/_train_tools.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_vision_transformers/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_vision_transformers/_core_transforms.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_vision_transformers/_offline_augmentation.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/PSO_optimization/_PSO.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/PSO_optimization/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/SQL/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/SQL/_dragon_SQL.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/VIF/_VIF_factor.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/VIF/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/_core/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/_core/_logger.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/_core/_schema_load_ops.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/_core/_script_info.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/constants.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/data_exploration/_cleaning.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/data_exploration/_plotting.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/data_exploration/_schema_ops.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ensemble_evaluation/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ensemble_evaluation/_ensemble_evaluation.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ensemble_inference/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ensemble_inference/_ensemble_inference.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ensemble_learning/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ensemble_learning/_ensemble_learning.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/excel_handler/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/excel_handler/_excel_handler.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/keys/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/math_utilities/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/math_utilities/_math_utilities.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/optimization_tools/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/optimization_tools/_optimization_bounds.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/optimization_tools/_optimization_plots.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/path_manager/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/path_manager/_dragonmanager.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/path_manager/_path_tools.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/plot_fonts/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/plot_fonts/_plot_fonts.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/schema/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/schema/_feature_schema.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/schema/_gui_schema.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/serde/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/serde/_serde.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/utilities/__init__.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/utilities/_translate.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/utilities/_utility_save_load.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/utilities/_utility_tools.py +0 -0
- {dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dragon-ml-toolbox
|
|
3
|
-
Version: 20.
|
|
3
|
+
Version: 20.9.0
|
|
4
4
|
Summary: Complete pipelines and helper tools for data science and machine learning projects.
|
|
5
5
|
Author-email: Karl Luigi Loza Vidaurre <luigiloza@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -174,6 +174,7 @@ ML_vision_transformers
|
|
|
174
174
|
optimization_tools
|
|
175
175
|
path_manager
|
|
176
176
|
plot_fonts
|
|
177
|
+
resampling
|
|
177
178
|
schema
|
|
178
179
|
serde
|
|
179
180
|
SQL
|
|
@@ -206,6 +207,7 @@ optimization_tools
|
|
|
206
207
|
path_manager
|
|
207
208
|
plot_fonts
|
|
208
209
|
PSO_optimization
|
|
210
|
+
resampling
|
|
209
211
|
schema
|
|
210
212
|
serde
|
|
211
213
|
SQL
|
|
@@ -81,6 +81,7 @@ ML_vision_transformers
|
|
|
81
81
|
optimization_tools
|
|
82
82
|
path_manager
|
|
83
83
|
plot_fonts
|
|
84
|
+
resampling
|
|
84
85
|
schema
|
|
85
86
|
serde
|
|
86
87
|
SQL
|
|
@@ -113,6 +114,7 @@ optimization_tools
|
|
|
113
114
|
path_manager
|
|
114
115
|
plot_fonts
|
|
115
116
|
PSO_optimization
|
|
117
|
+
resampling
|
|
116
118
|
schema
|
|
117
119
|
serde
|
|
118
120
|
SQL
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dragon-ml-toolbox
|
|
3
|
-
Version: 20.
|
|
3
|
+
Version: 20.9.0
|
|
4
4
|
Summary: Complete pipelines and helper tools for data science and machine learning projects.
|
|
5
5
|
Author-email: Karl Luigi Loza Vidaurre <luigiloza@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -174,6 +174,7 @@ ML_vision_transformers
|
|
|
174
174
|
optimization_tools
|
|
175
175
|
path_manager
|
|
176
176
|
plot_fonts
|
|
177
|
+
resampling
|
|
177
178
|
schema
|
|
178
179
|
serde
|
|
179
180
|
SQL
|
|
@@ -206,6 +207,7 @@ optimization_tools
|
|
|
206
207
|
path_manager
|
|
207
208
|
plot_fonts
|
|
208
209
|
PSO_optimization
|
|
210
|
+
resampling
|
|
209
211
|
schema
|
|
210
212
|
serde
|
|
211
213
|
SQL
|
{dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/dragon_ml_toolbox.egg-info/SOURCES.txt
RENAMED
|
@@ -48,6 +48,7 @@ ml_tools/ML_datasetmaster/_vision_datasetmaster.py
|
|
|
48
48
|
ml_tools/ML_evaluation/__init__.py
|
|
49
49
|
ml_tools/ML_evaluation/_classification.py
|
|
50
50
|
ml_tools/ML_evaluation/_feature_importance.py
|
|
51
|
+
ml_tools/ML_evaluation/_helpers.py
|
|
51
52
|
ml_tools/ML_evaluation/_loss.py
|
|
52
53
|
ml_tools/ML_evaluation/_regression.py
|
|
53
54
|
ml_tools/ML_evaluation/_sequence.py
|
|
@@ -136,6 +137,10 @@ ml_tools/path_manager/_dragonmanager.py
|
|
|
136
137
|
ml_tools/path_manager/_path_tools.py
|
|
137
138
|
ml_tools/plot_fonts/__init__.py
|
|
138
139
|
ml_tools/plot_fonts/_plot_fonts.py
|
|
140
|
+
ml_tools/resampling/__init__.py
|
|
141
|
+
ml_tools/resampling/_base_resampler.py
|
|
142
|
+
ml_tools/resampling/_multi_resampling.py
|
|
143
|
+
ml_tools/resampling/_single_resampling.py
|
|
139
144
|
ml_tools/schema/__init__.py
|
|
140
145
|
ml_tools/schema/_feature_schema.py
|
|
141
146
|
ml_tools/schema/_gui_schema.py
|
|
@@ -98,10 +98,11 @@ class _BaseMultiLabelFormat:
|
|
|
98
98
|
cmap: str = "BuGn",
|
|
99
99
|
ROC_PR_line: str='darkorange',
|
|
100
100
|
calibration_bins: Union[int, Literal['auto']]='auto',
|
|
101
|
-
font_size: int =
|
|
102
|
-
xtick_size: int=
|
|
103
|
-
ytick_size: int=
|
|
104
|
-
legend_size: int=
|
|
101
|
+
font_size: int = 26,
|
|
102
|
+
xtick_size: int=22,
|
|
103
|
+
ytick_size: int=22,
|
|
104
|
+
legend_size: int=26,
|
|
105
|
+
cm_font_size: int=26) -> None:
|
|
105
106
|
"""
|
|
106
107
|
Initializes the formatting configuration for multi-label classification metrics.
|
|
107
108
|
|
|
@@ -127,6 +128,8 @@ class _BaseMultiLabelFormat:
|
|
|
127
128
|
|
|
128
129
|
legend_size (int): Font size for plot legends.
|
|
129
130
|
|
|
131
|
+
cm_font_size (int): Font size for the confusion matrix.
|
|
132
|
+
|
|
130
133
|
<br>
|
|
131
134
|
|
|
132
135
|
### [Matplotlib Colormaps](https://matplotlib.org/stable/users/explain/colors/colormaps.html)
|
|
@@ -142,6 +145,7 @@ class _BaseMultiLabelFormat:
|
|
|
142
145
|
self.xtick_size = xtick_size
|
|
143
146
|
self.ytick_size = ytick_size
|
|
144
147
|
self.legend_size = legend_size
|
|
148
|
+
self.cm_font_size = cm_font_size
|
|
145
149
|
|
|
146
150
|
def __repr__(self) -> str:
|
|
147
151
|
parts = [
|
|
@@ -151,7 +155,8 @@ class _BaseMultiLabelFormat:
|
|
|
151
155
|
f"font_size={self.font_size}",
|
|
152
156
|
f"xtick_size={self.xtick_size}",
|
|
153
157
|
f"ytick_size={self.ytick_size}",
|
|
154
|
-
f"legend_size={self.legend_size}"
|
|
158
|
+
f"legend_size={self.legend_size}",
|
|
159
|
+
f"cm_font_size={self.cm_font_size}"
|
|
155
160
|
]
|
|
156
161
|
return f"{self.__class__.__name__}({', '.join(parts)})"
|
|
157
162
|
|
|
@@ -520,10 +525,11 @@ class FormatMultiLabelBinaryClassificationMetrics(_BaseMultiLabelFormat):
|
|
|
520
525
|
cmap: str = "BuGn",
|
|
521
526
|
ROC_PR_line: str='darkorange',
|
|
522
527
|
calibration_bins: Union[int, Literal['auto']]='auto',
|
|
523
|
-
font_size: int =
|
|
524
|
-
xtick_size: int=
|
|
525
|
-
ytick_size: int=
|
|
526
|
-
legend_size: int=
|
|
528
|
+
font_size: int = 26,
|
|
529
|
+
xtick_size: int=22,
|
|
530
|
+
ytick_size: int=22,
|
|
531
|
+
legend_size: int=26,
|
|
532
|
+
cm_font_size: int=26
|
|
527
533
|
) -> None:
|
|
528
534
|
super().__init__(cmap=cmap,
|
|
529
535
|
ROC_PR_line=ROC_PR_line,
|
|
@@ -531,7 +537,8 @@ class FormatMultiLabelBinaryClassificationMetrics(_BaseMultiLabelFormat):
|
|
|
531
537
|
font_size=font_size,
|
|
532
538
|
xtick_size=xtick_size,
|
|
533
539
|
ytick_size=ytick_size,
|
|
534
|
-
legend_size=legend_size
|
|
540
|
+
legend_size=legend_size,
|
|
541
|
+
cm_font_size=cm_font_size)
|
|
535
542
|
|
|
536
543
|
|
|
537
544
|
# Segmentation
|
|
@@ -133,7 +133,7 @@ class _BaseDatasetMaker(ABC):
|
|
|
133
133
|
|
|
134
134
|
# Get continuous feature indices *from the schema*
|
|
135
135
|
if schema.continuous_feature_names:
|
|
136
|
-
if verbose >=
|
|
136
|
+
if verbose >= 3:
|
|
137
137
|
_LOGGER.info("Getting continuous feature indices from schema.")
|
|
138
138
|
try:
|
|
139
139
|
# Convert columns to a standard list for .index()
|
|
@@ -189,7 +189,7 @@ class _BaseDatasetMaker(ABC):
|
|
|
189
189
|
# ------------------------------------------------------------------
|
|
190
190
|
|
|
191
191
|
if self.target_scaler is None:
|
|
192
|
-
if verbose >=
|
|
192
|
+
if verbose >= 3:
|
|
193
193
|
_LOGGER.info("Fitting a new DragonScaler on training targets.")
|
|
194
194
|
# Convert to float tensor for calculation
|
|
195
195
|
y_train_tensor = torch.tensor(y_train_arr, dtype=torch.float32)
|
|
@@ -202,6 +202,9 @@ class _BaseDatasetMaker(ABC):
|
|
|
202
202
|
y_val_tensor = self.target_scaler.transform(torch.tensor(y_val_arr, dtype=torch.float32))
|
|
203
203
|
y_test_tensor = self.target_scaler.transform(torch.tensor(y_test_arr, dtype=torch.float32))
|
|
204
204
|
return y_train_tensor.numpy(), y_val_tensor.numpy(), y_test_tensor.numpy()
|
|
205
|
+
|
|
206
|
+
if verbose >= 2:
|
|
207
|
+
_LOGGER.info("Target scaling transformation complete.")
|
|
205
208
|
|
|
206
209
|
return y_train_arr, y_val_arr, y_test_arr
|
|
207
210
|
|
|
@@ -214,6 +217,9 @@ class _BaseDatasetMaker(ABC):
|
|
|
214
217
|
|
|
215
218
|
@property
|
|
216
219
|
def train_dataset(self) -> Dataset:
|
|
220
|
+
"""
|
|
221
|
+
Returns the training dataset.
|
|
222
|
+
"""
|
|
217
223
|
if self._train_ds is None:
|
|
218
224
|
_LOGGER.error("Train Dataset not yet created.")
|
|
219
225
|
raise RuntimeError()
|
|
@@ -221,6 +227,9 @@ class _BaseDatasetMaker(ABC):
|
|
|
221
227
|
|
|
222
228
|
@property
|
|
223
229
|
def validation_dataset(self) -> Dataset:
|
|
230
|
+
"""
|
|
231
|
+
Returns the validation dataset.
|
|
232
|
+
"""
|
|
224
233
|
if self._val_ds is None:
|
|
225
234
|
_LOGGER.error("Validation Dataset not yet created.")
|
|
226
235
|
raise RuntimeError()
|
|
@@ -228,6 +237,9 @@ class _BaseDatasetMaker(ABC):
|
|
|
228
237
|
|
|
229
238
|
@property
|
|
230
239
|
def test_dataset(self) -> Dataset:
|
|
240
|
+
"""
|
|
241
|
+
Returns the test dataset.
|
|
242
|
+
"""
|
|
231
243
|
if self._test_ds is None:
|
|
232
244
|
_LOGGER.error("Test Dataset not yet created.")
|
|
233
245
|
raise RuntimeError()
|
|
@@ -235,30 +247,50 @@ class _BaseDatasetMaker(ABC):
|
|
|
235
247
|
|
|
236
248
|
@property
|
|
237
249
|
def feature_names(self) -> list[str]:
|
|
250
|
+
"""
|
|
251
|
+
Returns a list with the feature names.
|
|
252
|
+
"""
|
|
238
253
|
return self._feature_names
|
|
239
254
|
|
|
240
255
|
@property
|
|
241
256
|
def target_names(self) -> list[str]:
|
|
257
|
+
"""
|
|
258
|
+
Returns a list with the target names.
|
|
259
|
+
"""
|
|
242
260
|
return self._target_names
|
|
243
261
|
|
|
244
262
|
@property
|
|
245
263
|
def number_of_features(self) -> int:
|
|
264
|
+
"""
|
|
265
|
+
Returns the number of features.
|
|
266
|
+
"""
|
|
246
267
|
return len(self._feature_names)
|
|
247
268
|
|
|
248
269
|
@property
|
|
249
270
|
def number_of_targets(self) -> int:
|
|
271
|
+
"""
|
|
272
|
+
Returns the number of targets.
|
|
273
|
+
"""
|
|
250
274
|
return len(self._target_names)
|
|
251
275
|
|
|
252
276
|
@property
|
|
253
277
|
def id(self) -> Optional[str]:
|
|
278
|
+
"""
|
|
279
|
+
Returns the dataset ID if set, otherwise None.
|
|
280
|
+
"""
|
|
254
281
|
return self._id
|
|
255
282
|
|
|
256
283
|
@id.setter
|
|
257
284
|
def id(self, dataset_id: str):
|
|
258
|
-
if not isinstance(dataset_id, str):
|
|
285
|
+
if not isinstance(dataset_id, str):
|
|
286
|
+
_LOGGER.error("Dataset ID must be a string.")
|
|
287
|
+
raise ValueError()
|
|
259
288
|
self._id = dataset_id
|
|
260
289
|
|
|
261
290
|
def dataframes_info(self) -> None:
|
|
291
|
+
"""
|
|
292
|
+
Prints the shapes of the dataframes after the split.
|
|
293
|
+
"""
|
|
262
294
|
print("--- DataFrame Shapes After Split ---")
|
|
263
295
|
print(f" X_train shape: {self._X_train_shape}, y_train shape: {self._y_train_shape}")
|
|
264
296
|
print(f" X_val shape: {self._X_val_shape}, y_val shape: {self._y_val_shape}")
|
|
@@ -266,12 +298,26 @@ class _BaseDatasetMaker(ABC):
|
|
|
266
298
|
print("------------------------------------")
|
|
267
299
|
|
|
268
300
|
def save_feature_names(self, directory: Union[str, Path], verbose: bool=True) -> None:
|
|
301
|
+
"""
|
|
302
|
+
Saves the feature names to a text file.
|
|
303
|
+
|
|
304
|
+
Args:
|
|
305
|
+
directory (str | Path): Directory to save the feature names.
|
|
306
|
+
verbose (bool): Whether to print log messages.
|
|
307
|
+
"""
|
|
269
308
|
save_list_strings(list_strings=self._feature_names,
|
|
270
309
|
directory=directory,
|
|
271
310
|
filename=DatasetKeys.FEATURE_NAMES,
|
|
272
311
|
verbose=verbose)
|
|
273
312
|
|
|
274
313
|
def save_target_names(self, directory: Union[str, Path], verbose: bool=True) -> None:
|
|
314
|
+
"""
|
|
315
|
+
Saves the target names to a text file.
|
|
316
|
+
|
|
317
|
+
Args:
|
|
318
|
+
directory (str | Path): Directory to save the target names.
|
|
319
|
+
verbose (bool): Whether to print log messages.
|
|
320
|
+
"""
|
|
275
321
|
save_list_strings(list_strings=self._target_names,
|
|
276
322
|
directory=directory,
|
|
277
323
|
filename=DatasetKeys.TARGET_NAMES,
|
|
@@ -281,6 +327,10 @@ class _BaseDatasetMaker(ABC):
|
|
|
281
327
|
"""
|
|
282
328
|
Saves both feature and target scalers (if they exist) to a single .pth file
|
|
283
329
|
using a dictionary structure.
|
|
330
|
+
|
|
331
|
+
Args:
|
|
332
|
+
directory (str | Path): Directory to save the scaler.
|
|
333
|
+
verbose (bool): Whether to print log messages.
|
|
284
334
|
"""
|
|
285
335
|
if self.feature_scaler is None and self.target_scaler is None:
|
|
286
336
|
_LOGGER.warning("No scalers (feature or target) were fitted. Nothing to save.")
|
{dragon_ml_toolbox-20.7.1 → dragon_ml_toolbox-20.9.0}/ml_tools/ML_evaluation/_classification.py
RENAMED
|
@@ -28,6 +28,8 @@ from ..path_manager import make_fullpath, sanitize_filename
|
|
|
28
28
|
from .._core import get_logger
|
|
29
29
|
from ..keys._keys import _EvaluationConfig
|
|
30
30
|
|
|
31
|
+
from ._helpers import check_and_abbreviate_name
|
|
32
|
+
|
|
31
33
|
|
|
32
34
|
_LOGGER = get_logger("Classification Metrics")
|
|
33
35
|
|
|
@@ -85,7 +87,8 @@ def classification_metrics(save_dir: Union[str, Path],
|
|
|
85
87
|
try:
|
|
86
88
|
sorted_items = sorted(class_map.items(), key=lambda item: item[1])
|
|
87
89
|
map_labels = [item[1] for item in sorted_items]
|
|
88
|
-
|
|
90
|
+
# Abbreviate display labels if needed
|
|
91
|
+
map_display_labels = [check_and_abbreviate_name(item[0]) for item in sorted_items]
|
|
89
92
|
except Exception as e:
|
|
90
93
|
_LOGGER.warning(f"Could not parse 'class_map': {e}")
|
|
91
94
|
map_labels = None
|
|
@@ -397,6 +400,10 @@ def classification_metrics(save_dir: Union[str, Path],
|
|
|
397
400
|
# --- Step 1: Get binned data directly ---
|
|
398
401
|
# calculates reliability diagram data without needing a temporary plot
|
|
399
402
|
prob_true, prob_pred = calibration_curve(y_true_binary, y_score, n_bins=dynamic_bins)
|
|
403
|
+
|
|
404
|
+
# Anchor the plot to (0,0) and (1,1) to ensure the line spans the full diagonal
|
|
405
|
+
prob_true = np.concatenate(([0.0], prob_true, [1.0]))
|
|
406
|
+
prob_pred = np.concatenate(([0.0], prob_pred, [1.0]))
|
|
400
407
|
|
|
401
408
|
# --- Step 2: Plot ---
|
|
402
409
|
ax_cal.plot([0, 1], [0, 1], 'k--', label='Perfectly calibrated')
|
|
@@ -467,6 +474,9 @@ def multi_label_classification_metrics(
|
|
|
467
474
|
|
|
468
475
|
save_dir_path = make_fullpath(save_dir, make=True, enforce="directory")
|
|
469
476
|
|
|
477
|
+
# --- Pre-process target names for abbreviation ---
|
|
478
|
+
target_names = [check_and_abbreviate_name(name) for name in target_names]
|
|
479
|
+
|
|
470
480
|
# --- Parse Config or use defaults ---
|
|
471
481
|
if config is None:
|
|
472
482
|
# Create a default config if one wasn't provided
|
|
@@ -481,6 +491,10 @@ def multi_label_classification_metrics(
|
|
|
481
491
|
ytick_size = format_config.ytick_size
|
|
482
492
|
legend_size = format_config.legend_size
|
|
483
493
|
base_font_size = format_config.font_size
|
|
494
|
+
|
|
495
|
+
# config font size for heatmap
|
|
496
|
+
cm_font_size = format_config.cm_font_size
|
|
497
|
+
cm_tick_size = cm_font_size - 4
|
|
484
498
|
|
|
485
499
|
# --- Calculate and Save Overall Metrics (using y_pred) ---
|
|
486
500
|
h_loss = hamming_loss(y_true, y_pred)
|
|
@@ -488,7 +502,7 @@ def multi_label_classification_metrics(
|
|
|
488
502
|
j_score_macro = jaccard_score(y_true, y_pred, average='macro')
|
|
489
503
|
|
|
490
504
|
overall_report = (
|
|
491
|
-
f"Overall Multi-Label Metrics:\n"
|
|
505
|
+
f"Overall Multi-Label Metrics:\n"
|
|
492
506
|
f"--------------------------------------------------\n"
|
|
493
507
|
f"Hamming Loss: {h_loss:.4f}\n"
|
|
494
508
|
f"Jaccard Score (micro): {j_score_micro:.4f}\n"
|
|
@@ -499,9 +513,65 @@ def multi_label_classification_metrics(
|
|
|
499
513
|
overall_report_path = save_dir_path / "classification_report.txt"
|
|
500
514
|
overall_report_path.write_text(overall_report)
|
|
501
515
|
|
|
516
|
+
# --- Save Classification Report Heatmap (Multi-label) ---
|
|
517
|
+
try:
|
|
518
|
+
# Generate full report as dict
|
|
519
|
+
full_report_dict = classification_report(y_true, y_pred, target_names=target_names, output_dict=True)
|
|
520
|
+
report_df = pd.DataFrame(full_report_dict)
|
|
521
|
+
|
|
522
|
+
# Cleanup
|
|
523
|
+
# Remove 'accuracy' column if it exists
|
|
524
|
+
report_df = report_df.drop(columns=['accuracy'], errors='ignore')
|
|
525
|
+
|
|
526
|
+
# Remove 'support' row explicitly
|
|
527
|
+
if 'support' in report_df.index:
|
|
528
|
+
report_df = report_df.drop(index='support')
|
|
529
|
+
|
|
530
|
+
# Transpose: Rows = Classes/Averages, Cols = Metrics
|
|
531
|
+
plot_df = report_df.T
|
|
532
|
+
|
|
533
|
+
# Dynamic Height
|
|
534
|
+
fig_height = max(5.0, len(plot_df.index) * 0.5 + 4.0)
|
|
535
|
+
fig_width = 8.0
|
|
536
|
+
|
|
537
|
+
fig_heat, ax_heat = plt.subplots(figsize=(fig_width, fig_height), dpi=_EvaluationConfig.DPI)
|
|
538
|
+
|
|
539
|
+
# Plot
|
|
540
|
+
sns.heatmap(plot_df,
|
|
541
|
+
annot=True,
|
|
542
|
+
cmap=format_config.cmap,
|
|
543
|
+
fmt='.2f',
|
|
544
|
+
vmin=0.0,
|
|
545
|
+
vmax=1.0,
|
|
546
|
+
cbar_kws={'shrink': 0.9})
|
|
547
|
+
|
|
548
|
+
ax_heat.set_title("Classification Report Heatmap", pad=_EvaluationConfig.LABEL_PADDING, fontsize=cm_font_size)
|
|
549
|
+
|
|
550
|
+
# manually increase the font size of the elements
|
|
551
|
+
for text in ax_heat.texts:
|
|
552
|
+
text.set_fontsize(cm_tick_size)
|
|
553
|
+
|
|
554
|
+
cbar = ax_heat.collections[0].colorbar
|
|
555
|
+
cbar.ax.tick_params(labelsize=cm_tick_size - 4) # type: ignore
|
|
556
|
+
|
|
557
|
+
ax_heat.tick_params(axis='x', labelsize=cm_tick_size, pad=_EvaluationConfig.LABEL_PADDING)
|
|
558
|
+
ax_heat.tick_params(axis='y', labelsize=cm_tick_size, pad=_EvaluationConfig.LABEL_PADDING, rotation=0)
|
|
559
|
+
|
|
560
|
+
plt.tight_layout()
|
|
561
|
+
heatmap_path = save_dir_path / "classification_report_heatmap.svg"
|
|
562
|
+
plt.savefig(heatmap_path)
|
|
563
|
+
_LOGGER.info(f"📊 Report heatmap saved as '{heatmap_path.name}'")
|
|
564
|
+
plt.close(fig_heat)
|
|
565
|
+
|
|
566
|
+
except Exception as e:
|
|
567
|
+
_LOGGER.error(f"Could not generate multi-label classification report heatmap: {e}")
|
|
568
|
+
|
|
502
569
|
# --- Per-Label Metrics and Plots ---
|
|
503
570
|
for i, name in enumerate(target_names):
|
|
504
|
-
|
|
571
|
+
# strip whitespace from name
|
|
572
|
+
name = name.strip()
|
|
573
|
+
|
|
574
|
+
# print(f" -> Evaluating label: '{name}'")
|
|
505
575
|
true_i = y_true[:, i]
|
|
506
576
|
pred_i = y_pred[:, i] # Use passed-in y_pred
|
|
507
577
|
prob_i = y_prob[:, i] # Use passed-in y_prob
|
|
@@ -537,7 +607,7 @@ def multi_label_classification_metrics(
|
|
|
537
607
|
ax_cm.tick_params(axis='y', labelsize=ytick_size)
|
|
538
608
|
|
|
539
609
|
# Set titles and labels with padding
|
|
540
|
-
ax_cm.set_title(f"Confusion Matrix
|
|
610
|
+
ax_cm.set_title(f"Confusion Matrix - {name}", pad=_EvaluationConfig.LABEL_PADDING, fontsize=base_font_size + 2)
|
|
541
611
|
ax_cm.set_xlabel(ax_cm.get_xlabel(), labelpad=_EvaluationConfig.LABEL_PADDING, fontsize=base_font_size)
|
|
542
612
|
ax_cm.set_ylabel(ax_cm.get_ylabel(), labelpad=_EvaluationConfig.LABEL_PADDING, fontsize=base_font_size)
|
|
543
613
|
|
|
@@ -594,7 +664,7 @@ def multi_label_classification_metrics(
|
|
|
594
664
|
ax_roc.plot(fpr, tpr, label=f'AUC = {auc:.2f}', color=format_config.ROC_PR_line) # Use config color
|
|
595
665
|
ax_roc.plot([0, 1], [0, 1], 'k--')
|
|
596
666
|
|
|
597
|
-
ax_roc.set_title(f'ROC Curve
|
|
667
|
+
ax_roc.set_title(f'ROC Curve - {name}', pad=_EvaluationConfig.LABEL_PADDING, fontsize=base_font_size + 2)
|
|
598
668
|
ax_roc.set_xlabel('False Positive Rate', labelpad=_EvaluationConfig.LABEL_PADDING, fontsize=base_font_size)
|
|
599
669
|
ax_roc.set_ylabel('True Positive Rate', labelpad=_EvaluationConfig.LABEL_PADDING, fontsize=base_font_size)
|
|
600
670
|
|
|
@@ -616,7 +686,7 @@ def multi_label_classification_metrics(
|
|
|
616
686
|
ap_score = average_precision_score(true_i, prob_i)
|
|
617
687
|
fig_pr, ax_pr = plt.subplots(figsize=CLASSIFICATION_PLOT_SIZE, dpi=DPI_value)
|
|
618
688
|
ax_pr.plot(recall, precision, label=f'AP = {ap_score:.2f}', color=format_config.ROC_PR_line) # Use config color
|
|
619
|
-
ax_pr.set_title(f'
|
|
689
|
+
ax_pr.set_title(f'PR Curve - {name}', pad=_EvaluationConfig.LABEL_PADDING, fontsize=base_font_size + 2)
|
|
620
690
|
ax_pr.set_xlabel('Recall', labelpad=_EvaluationConfig.LABEL_PADDING, fontsize=base_font_size)
|
|
621
691
|
ax_pr.set_ylabel('Precision', labelpad=_EvaluationConfig.LABEL_PADDING, fontsize=base_font_size)
|
|
622
692
|
|
|
@@ -654,15 +724,20 @@ def multi_label_classification_metrics(
|
|
|
654
724
|
# Calculate calibration curve for this specific label
|
|
655
725
|
prob_true, prob_pred = calibration_curve(true_i, prob_i, n_bins=dynamic_bins)
|
|
656
726
|
|
|
727
|
+
# Anchor the plot to (0,0) and (1,1)
|
|
728
|
+
prob_true = np.concatenate(([0.0], prob_true, [1.0]))
|
|
729
|
+
prob_pred = np.concatenate(([0.0], prob_pred, [1.0]))
|
|
730
|
+
|
|
731
|
+
# Plot the calibration curve
|
|
657
732
|
ax_cal.plot([0, 1], [0, 1], 'k--', label='Perfectly calibrated')
|
|
658
733
|
ax_cal.plot(prob_pred,
|
|
659
734
|
prob_true,
|
|
660
735
|
marker='o',
|
|
661
736
|
linewidth=2,
|
|
662
|
-
label=f"Calibration
|
|
737
|
+
label=f"Model Calibration",
|
|
663
738
|
color=format_config.ROC_PR_line)
|
|
664
739
|
|
|
665
|
-
ax_cal.set_title(f'
|
|
740
|
+
ax_cal.set_title(f'Calibration - {name}', pad=_EvaluationConfig.LABEL_PADDING, fontsize=base_font_size + 2)
|
|
666
741
|
ax_cal.set_xlabel('Mean Predicted Probability', labelpad=_EvaluationConfig.LABEL_PADDING, fontsize=base_font_size)
|
|
667
742
|
ax_cal.set_ylabel('Fraction of Positives', labelpad=_EvaluationConfig.LABEL_PADDING, fontsize=base_font_size)
|
|
668
743
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from ..keys._keys import _EvaluationConfig
|
|
2
|
+
from ..path_manager import sanitize_filename
|
|
3
|
+
from .._core import get_logger
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
_LOGGER = get_logger("Metrics Helper")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def check_and_abbreviate_name(name: str) -> str:
|
|
10
|
+
"""
|
|
11
|
+
Checks if a name exceeds the NAME_LIMIT. If it does, creates an abbreviation
|
|
12
|
+
(initials of words) or truncates it if the abbreviation is empty.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
name (str): The original label or target name.
|
|
16
|
+
|
|
17
|
+
Returns:
|
|
18
|
+
str: The potentially abbreviated name.
|
|
19
|
+
"""
|
|
20
|
+
limit = _EvaluationConfig.NAME_LIMIT
|
|
21
|
+
|
|
22
|
+
# Strip whitespace
|
|
23
|
+
name = name.strip()
|
|
24
|
+
|
|
25
|
+
if len(name) <= limit:
|
|
26
|
+
return name
|
|
27
|
+
|
|
28
|
+
# Attempt abbreviation: First letter of each word (split by space or underscore)
|
|
29
|
+
parts = [w for w in name.replace("_", " ").split() if w]
|
|
30
|
+
abbr = "".join(p[0].upper() for p in parts)
|
|
31
|
+
|
|
32
|
+
# Keep only alphanumeric characters
|
|
33
|
+
abbr = "".join(ch for ch in abbr if ch.isalnum())
|
|
34
|
+
|
|
35
|
+
# Fallback if abbreviation failed or is empty
|
|
36
|
+
if not abbr:
|
|
37
|
+
sanitized = sanitize_filename(name)
|
|
38
|
+
abbr = sanitized[:limit]
|
|
39
|
+
|
|
40
|
+
_LOGGER.warning(f"Label '{name}' is too long. Abbreviating to '{abbr}'.")
|
|
41
|
+
return abbr
|
|
@@ -19,6 +19,8 @@ from ..path_manager import make_fullpath, sanitize_filename
|
|
|
19
19
|
from .._core import get_logger
|
|
20
20
|
from ..keys._keys import _EvaluationConfig
|
|
21
21
|
|
|
22
|
+
from ._helpers import check_and_abbreviate_name
|
|
23
|
+
|
|
22
24
|
|
|
23
25
|
_LOGGER = get_logger("Regression Metrics")
|
|
24
26
|
|
|
@@ -180,6 +182,9 @@ def multi_target_regression_metrics(
|
|
|
180
182
|
if y_true.shape[1] != len(target_names):
|
|
181
183
|
_LOGGER.error("Number of target names must match the number of columns in y_true.")
|
|
182
184
|
raise ValueError()
|
|
185
|
+
|
|
186
|
+
# --- Pre-process target names for abbreviation ---
|
|
187
|
+
target_names = [check_and_abbreviate_name(name) for name in target_names]
|
|
183
188
|
|
|
184
189
|
save_dir_path = make_fullpath(save_dir, make=True, enforce="directory")
|
|
185
190
|
metrics_summary = []
|
|
@@ -2,6 +2,7 @@ from ._analysis import (
|
|
|
2
2
|
summarize_dataframe,
|
|
3
3
|
show_null_columns,
|
|
4
4
|
match_and_filter_columns_by_regex,
|
|
5
|
+
check_class_balance,
|
|
5
6
|
)
|
|
6
7
|
|
|
7
8
|
from ._cleaning import (
|
|
@@ -28,6 +29,7 @@ from ._features import (
|
|
|
28
29
|
split_continuous_binary,
|
|
29
30
|
split_continuous_categorical_targets,
|
|
30
31
|
encode_categorical_features,
|
|
32
|
+
encode_classification_target,
|
|
31
33
|
reconstruct_one_hot,
|
|
32
34
|
reconstruct_binary,
|
|
33
35
|
reconstruct_multibinary,
|
|
@@ -44,7 +46,6 @@ from .._core import _imprimir_disponibles
|
|
|
44
46
|
|
|
45
47
|
__all__ = [
|
|
46
48
|
"summarize_dataframe",
|
|
47
|
-
"show_null_columns",
|
|
48
49
|
"drop_constant_columns",
|
|
49
50
|
"drop_rows_with_missing_data",
|
|
50
51
|
"drop_columns_with_missing_data",
|
|
@@ -61,10 +62,13 @@ __all__ = [
|
|
|
61
62
|
"plot_categorical_vs_target",
|
|
62
63
|
"plot_correlation_heatmap",
|
|
63
64
|
"encode_categorical_features",
|
|
65
|
+
"encode_classification_target",
|
|
64
66
|
"finalize_feature_schema",
|
|
65
67
|
"apply_feature_schema",
|
|
66
68
|
"reconstruct_from_schema",
|
|
67
69
|
"match_and_filter_columns_by_regex",
|
|
70
|
+
"show_null_columns",
|
|
71
|
+
"check_class_balance",
|
|
68
72
|
"standardize_percentages",
|
|
69
73
|
"reconstruct_one_hot",
|
|
70
74
|
"reconstruct_binary",
|