pybear-dask 0.2.0__tar.gz → 0.2.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.
Files changed (112) hide show
  1. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/CHANGELOG.md +23 -5
  2. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/PKG-INFO +8 -3
  3. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/README.rst +7 -1
  4. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/pyproject.toml +1 -2
  5. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/_version.py +3 -9
  6. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/GSTCVDask.py +31 -42
  7. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_fit/_estimator_fit_params_helper.py +1 -1
  8. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_fit/_fold_splitter.py +2 -4
  9. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_fit/_get_kfold.py +2 -3
  10. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_fit/_parallelized_fit.py +4 -5
  11. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_fit/_parallelized_scorer.py +3 -4
  12. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_fit/_parallelized_train_scorer.py +3 -4
  13. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_param_conditioning/_scheduler.py +3 -5
  14. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_type_aliases.py +9 -13
  15. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_validation/_y.py +1 -1
  16. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/autogridsearch/AutoGSTCVDask.py +7 -14
  17. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/autogridsearch/AutoGridSearchCVDask.py +6 -20
  18. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/autogridsearch/_autogridsearch_wrapper/_refit_can_be_skipped.py +2 -3
  19. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/base/conftest.py +4 -5
  20. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCV/validation_init_test.py +0 -21
  21. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/fit/estimator_fit_params_helper_test.py +0 -6
  22. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/fit/fold_splitter_test.py +0 -8
  23. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/fit/get_kfold_test.py +1 -7
  24. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/fit/parellelized_scorer_test.py +0 -11
  25. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/fit/parellelized_train_scorer_test.py +0 -13
  26. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/validation/validation_init_3min25sec_test.py +11 -33
  27. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVMixin/validation/cv_val_test.py +0 -2
  28. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVMixin/validation/predict_proba_test.py +0 -6
  29. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/conftest.py +1 -2
  30. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/autogridsearch/verification_AutoGSTCVDask_1min39sec_test.py +1 -1
  31. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/autogridsearch/verification_AutoGridSearchCVDask_Xsec_test.py +1 -1
  32. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/autogridsearch/verification_dask_gscvs_10sec_test.py +3 -3
  33. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/ColumnDeduplicator/dask_wrappers_12sec_test.py +1 -1
  34. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/InterceptManager/dask_wrappers_10sec_test.py +1 -1
  35. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/MinCountTransformer/conftest.py +8 -8
  36. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/MinCountTransformer/dask_wrappers_test.py +1 -1
  37. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/SlimPolyFeatures/dask_wrappers_18sec_test.py +1 -1
  38. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/conftest.py +14 -17
  39. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/conftest_X_factory_18sec_test.py +3 -22
  40. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/LICENSE +0 -0
  41. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/__init__.py +0 -0
  42. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/base/__init__.py +0 -0
  43. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/base/_is_classifier.py +0 -0
  44. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/__init__.py +0 -0
  45. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_fit/__init__.py +0 -0
  46. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_param_conditioning/__init__.py +0 -0
  47. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_validation/__init__.py +0 -0
  48. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_validation/_cache_cv.py +0 -0
  49. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_validation/_dask_estimator.py +0 -0
  50. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_validation/_iid.py +0 -0
  51. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/_GSTCVDask/_validation/_validation.py +0 -0
  52. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/GSTCV/__init__.py +0 -0
  53. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/__init__.py +0 -0
  54. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/autogridsearch/__init__.py +0 -0
  55. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/src/pybear_dask/model_selection/autogridsearch/_autogridsearch_wrapper/__init__.py +0 -0
  56. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/11min45sec +0 -0
  57. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/__init__.py +0 -0
  58. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/base/1min38sec +0 -0
  59. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/base/__init__.py +0 -0
  60. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/base/get_feature_names_test.py +0 -0
  61. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/base/is_classifier_1min35sec_test.py +0 -0
  62. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/conftest.py +0 -0
  63. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/9min10sec +0 -0
  64. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/8min00sec +0 -0
  65. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCV/__init__.py +0 -0
  66. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCV/estimator_test.py +0 -0
  67. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCV/estimator_wrapped_test.py +0 -0
  68. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/8min58sec +0 -0
  69. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/__init__.py +0 -0
  70. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/fit/3min48sec +0 -0
  71. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/fit/__init__.py +0 -0
  72. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/fit/accuracy_50sec_test.py +0 -0
  73. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/fit/cache_cv__cv__iid__2min2sec_test.py +0 -0
  74. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/fit/fit__fit_params_test_24sec_test.py +0 -0
  75. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/fit/parallelized_fit_test.py +0 -0
  76. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/param_conditioning/13sec +0 -0
  77. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/param_conditioning/__init__.py +0 -0
  78. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/param_conditioning/scheduler_13sec_test.py +0 -0
  79. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/validation/3min49sec +0 -0
  80. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/validation/__init__.py +0 -0
  81. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/validation/cache_cv_test.py +0 -0
  82. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/validation/dask_estimator_test.py +0 -0
  83. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/validation/dask_estimator_wrapped_test.py +0 -0
  84. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/validation/iid_test.py +0 -0
  85. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/validation/validation_test.py +0 -0
  86. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/validation/validation_y_fit_dask_test.py +0 -0
  87. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/validation/validation_y_score_dask_38sec_test.py +0 -0
  88. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVDask/validation/y_test.py +0 -0
  89. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVMixin/__init__.py +0 -0
  90. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVMixin/param_conditioning/__init__.py +0 -0
  91. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVMixin/param_conditioning/cv_test.py +0 -0
  92. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVMixin/validation/__init__.py +0 -0
  93. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/GSTCVMixin/validation/estimator_val_test.py +0 -0
  94. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/__init__.py +0 -0
  95. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/conftest_gstcv_dask_fixture_37sec_test.py +0 -0
  96. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/GSTCV/conftest_list_of_fixtures +0 -0
  97. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/__init__.py +0 -0
  98. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/autogridsearch/3min54sec +0 -0
  99. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/autogridsearch/__init__.py +0 -0
  100. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/autogridsearch/autogridsearch_wrapper/__init__.py +0 -0
  101. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/autogridsearch/autogridsearch_wrapper/refit_can_be_skipped_6sec_test.py +0 -0
  102. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/model_selection/autogridsearch/conftest.py +0 -0
  103. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/40sec +0 -0
  104. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/ColumnDeduplicator/__init__.py +0 -0
  105. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/ColumnDeduplicator/conftest.py +0 -0
  106. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/InterceptManager/__init__.py +0 -0
  107. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/InterceptManager/conftest.py +0 -0
  108. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/MinCountTransformer/__init__.py +0 -0
  109. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/SlimPolyFeatures/__init__.py +0 -0
  110. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/SlimPolyFeatures/conftest.py +0 -0
  111. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/preprocessing/__init__.py +0 -0
  112. {pybear_dask-0.2.0 → pybear_dask-0.2.1}/tests/version_test.py +0 -0
@@ -6,16 +6,34 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
 
9
-
10
- ## [0.2.0] - 2025-07-31
9
+ ## [0.2.1] - 2025-08-16
11
10
 
12
11
  ### Added
13
- - base:
12
+ - None
13
+
14
+ ### Changed
15
+ - Optional and Union type hints replaced with pipes
16
+ - numbers.Integral in docs and type hints changed to int
17
+
18
+ ### Deprecated
19
+ - None
20
+
21
+ ### Removed
22
+ - None
14
23
 
24
+ ### Fixed
25
+ - None
26
+
27
+ ### Security
28
+ - None
29
+
30
+ ## [0.2.0] - 2025-07-28
31
+
32
+ ### Added
33
+ - base:
15
34
  is_classifier
16
35
 
17
- - model_selection:
18
-
36
+ - model_selection:
19
37
  GSTCVDask
20
38
  AutoGridSearchCVDask
21
39
  AutoGSTCVDask
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pybear-dask
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Python modules for data analytics applications with dask
5
5
  License: BSD-3-Clause
6
6
  Keywords: python data analytics pybear dask
@@ -16,7 +16,6 @@ Classifier: Programming Language :: Python :: 3.12
16
16
  Requires-Dist: dask (<2025.1)
17
17
  Requires-Dist: dask-ml (<2025.1)
18
18
  Requires-Dist: distributed (<2025.1)
19
- Requires-Dist: polars-lts-cpu (>=1.31.0,<2.0.0)
20
19
  Requires-Dist: pybear (>=0.2.0)
21
20
  Requires-Dist: scikit-learn (<1.7)
22
21
  Project-URL: Homepage, https://github.com/PylarBear/pybear-dask
@@ -71,11 +70,17 @@ pybear-dask
71
70
  :target: https://pepy.tech/project/pybear-dask/
72
71
  :alt: PyPI Downloads
73
72
 
73
+ |DOI|
74
+
75
+ .. |DOI| image:: https://zenodo.org/badge/1009051313.svg
76
+ :target: https://doi.org/10.5281/zenodo.16548280
77
+ :alt: DOI
78
+
74
79
  .. |PythonVersion| replace:: >=3.10, <3.13
75
80
  .. |DaskVersion| replace:: <2025.1.0
76
81
  .. |DaskMLVersion| replace:: <2025.1.0
77
82
  .. |DistributedVersion| replace:: <2025.1.0
78
- .. |PybearVersion| replace:: >=0.1.22
83
+ .. |PybearVersion| replace:: >=0.2.0
79
84
  .. |PytestVersion| replace:: >=7.0.0
80
85
 
81
86
 
@@ -46,11 +46,17 @@ pybear-dask
46
46
  :target: https://pepy.tech/project/pybear-dask/
47
47
  :alt: PyPI Downloads
48
48
 
49
+ |DOI|
50
+
51
+ .. |DOI| image:: https://zenodo.org/badge/1009051313.svg
52
+ :target: https://doi.org/10.5281/zenodo.16548280
53
+ :alt: DOI
54
+
49
55
  .. |PythonVersion| replace:: >=3.10, <3.13
50
56
  .. |DaskVersion| replace:: <2025.1.0
51
57
  .. |DaskMLVersion| replace:: <2025.1.0
52
58
  .. |DistributedVersion| replace:: <2025.1.0
53
- .. |PybearVersion| replace:: >=0.1.22
59
+ .. |PybearVersion| replace:: >=0.2.0
54
60
  .. |PytestVersion| replace:: >=7.0.0
55
61
 
56
62
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pybear-dask"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "Python modules for data analytics applications with dask"
5
5
  license = "BSD-3-clause"
6
6
  authors = ["Bill Sousa <WKSJR99@msn.com>"]
@@ -34,7 +34,6 @@ dask-ml = "<2025.1"
34
34
  distributed = "<2025.1"
35
35
  pybear = ">=0.2.0" #{ version = ">=0.1.22", source = "testpypi" }
36
36
  scikit-learn = "<1.7"
37
- polars-lts-cpu = "^1.31.0"
38
37
 
39
38
 
40
39
  [tool.poetry.group.dev.dependencies]
@@ -5,21 +5,15 @@
5
5
  #
6
6
 
7
7
 
8
- from typing import Tuple
9
- from typing_extensions import Union
10
- import numpy as np
11
8
 
9
+ import numpy as np
12
10
 
13
- try:
14
- from importlib.metadata import version as get_version
15
- except ImportError:
16
- # For older Python versions, use importlib-metadata package
17
- from importlib_metadata import version as get_version
11
+ from importlib.metadata import version as get_version
18
12
 
19
13
 
20
14
  version: str
21
15
  __version__: str
22
- VERSION_TUPLE = Tuple[Union[int, str], ...]
16
+ VERSION_TUPLE = tuple[int | str, ...]
23
17
  version_tuple: VERSION_TUPLE
24
18
  __version_tuple__: VERSION_TUPLE
25
19
 
@@ -7,13 +7,9 @@
7
7
 
8
8
 
9
9
  from typing import (
10
+ Any,
10
11
  Callable,
11
12
  Iterable,
12
- Optional
13
- )
14
- from typing_extensions import (
15
- Any,
16
- Union
17
13
  )
18
14
  from ._type_aliases import (
19
15
  DaskXType,
@@ -111,7 +107,7 @@ class GSTCVDask(_GSTCVMixin):
111
107
  is explicitly designed for use with dask objects (estimators,
112
108
  arrays, and dataframes.) pybear `GSTCV` is recommended for
113
109
  non-dask classifiers.
114
- param_grid : Union[ParamGridInputType, ParamGridsInputType]
110
+ param_grid : ParamGridInputType | ParamGridsInputType
115
111
  Required. A dictionary with hyperparameters names (str) as keys
116
112
  and list-likes of respective settings to try as values. Can also
117
113
  be a list-like of such dictionaries, and the grids spanned by
@@ -210,7 +206,7 @@ class GSTCVDask(_GSTCVMixin):
210
206
 
211
207
  def your_metric_wrapper(y_true, y_pred):
212
208
  return your_metric(y_true, y_pred, **hard_coded_kwargs)
213
- iid : Optional[bool], default=True
209
+ iid : bool, default=True
214
210
  `iid` is ignored when `cv` is an iterable. Indicates whether
215
211
  the data's examples are believed to have random distribution
216
212
  (True) or if the examples are organized non-randomly in some
@@ -219,7 +215,7 @@ class GSTCVDask(_GSTCVMixin):
219
215
  this can be an expensive process. Otherwise, if the data is iid,
220
216
  KFold can handle the data as contiguous chunks which is much
221
217
  more efficient.
222
- refit : Optional[Union[bool, str, Callable]], default=True
218
+ refit : bool | str | Callable, default=True
223
219
  After the grid search is done, fit the whole dataset on the
224
220
  estimator using the best found hyperparameters and expose this
225
221
  fitted estimator via the :attr:`best_estimator_` attribute. Also,
@@ -252,7 +248,7 @@ class GSTCVDask(_GSTCVMixin):
252
248
 
253
249
  See the `scoring` parameter to know more about multiple metric
254
250
  evaluation.
255
- cv : Optional[Union[numbers.Integral, Iterable, None]], default=None
251
+ cv : int | Iterable | None, default=None
256
252
  Sets the cross-validation splitting strategy.
257
253
 
258
254
  Possible inputs for cv are:
@@ -269,21 +265,21 @@ class GSTCVDask(_GSTCVMixin):
269
265
  of iterables. `GSTCVDask` will catch out of range indices and
270
266
  raise an error but any validation beyond that is up to the user
271
267
  outside of `GSTCVDask`.
272
- verbose : Optional[numbers.Real], default=0
268
+ verbose : numbers.Real, default=0
273
269
  The amount of verbosity to display to screen during the grid
274
270
  search. Accepts integers from 0 to 10. 0 means no information
275
271
  displayed to the screen, 10 means full verbosity. Non-numbers
276
272
  are rejected. Boolean False is set to 0, boolean True is set to
277
273
  10. Negative numbers are rejected. Numbers greater than 10 are
278
274
  set to 10. Floats are rounded to integers.
279
- error_score : Optional[ErrorScoreType], default='raise'
275
+ error_score : ErrorScoreType, default='raise'
280
276
  Score to assign if the estimator raises an error while fitting
281
277
  on a train fold. If set to ‘raise’, the error is raised. If a
282
278
  numeric value is given, a warning is raised and the error score
283
279
  value is inserted into the subsequent calculations in place of
284
280
  the missing value(s). This parameter does not affect the refit
285
281
  step, which will always raise the error.
286
- return_train_score : Optional[bool]
282
+ return_train_score : bool
287
283
  If False, the `cv_results_` attribute will not include training
288
284
  scores. If True, the train data is scored using all the scorers
289
285
  at the best respective threshold(s) found for the test data.
@@ -291,7 +287,7 @@ class GSTCVDask(_GSTCVMixin):
291
287
  or over-fittedness. However, computing the scores on the training
292
288
  set can be computationally expensive and is not required to
293
289
  select the hyperparameters that yield the best performance.
294
- scheduler : Optional[Union[Client, Scheduler, None]], default=None
290
+ scheduler : Client | Scheduler | None, default=None
295
291
  A passed scheduler supersedes all other external schedulers.
296
292
  When a scheduler is explicitly passed, `GSTCVDask` does not
297
293
  perform any validation or verification but allows that to be
@@ -313,14 +309,14 @@ class GSTCVDask(_GSTCVMixin):
313
309
  should be handled by the user external to the `GSTCVDask` module.
314
310
  As much as possible, dask and distributed objects are allowed to
315
311
  flow through without any hard-coded input.
316
- n_jobs : Optional[Union[int, None]], default=None
312
+ n_jobs : int | None, default=None
317
313
  Active only if no scheduler is available. That is, if a
318
314
  scheduler is not passed to `scheduler`, if no global scheduler
319
315
  is available, and if there is no scheduler context manager, only
320
316
  then does `n_jobs` become effectual. In this case, `GSTCVDask`
321
317
  creates a Client instance using local multiprocessing with
322
318
  `n_workers=n_jobs`.
323
- cache_cv : Optional[bool], default=True
319
+ cache_cv : bool, default=True
324
320
  Indicates if the train/test folds of the data are to be stored
325
321
  when first generated, or if the folds are generated from X, y
326
322
  and the KFold indices at each point of need. Caching all the
@@ -449,7 +445,6 @@ class GSTCVDask(_GSTCVMixin):
449
445
  refit_time_ : float
450
446
  Seconds elapsed when refitting the best model on the whole
451
447
  dataset. Only exposed when `refit` is not False.
452
-
453
448
  multimetric_ : bool
454
449
  Whether several scoring metrics were used. False if one scorer
455
450
  was used, otherwise True. Always exposed after fit.
@@ -490,7 +485,7 @@ class GSTCVDask(_GSTCVMixin):
490
485
  Sequence[ParamGridInputType]
491
486
 
492
487
  ThresholdsInputType:
493
- Union[None, numbers.Real, Sequence[numbers.Real]]
488
+ None | numbers.Real | Sequence[numbers.Real]
494
489
 
495
490
  DaskSlicerType:
496
491
  dask.array.core.Array
@@ -512,27 +507,23 @@ class GSTCVDask(_GSTCVMixin):
512
507
  Callable[[Iterable, Iterable], numbers.Real]
513
508
 
514
509
  ScorerInputType:
515
- Union[
516
- ScorerNameTypes,
517
- Sequence[ScorerNameTypes],
518
- ScorerCallableType,
519
- dict[str, ScorerCallableType]
520
- ]
510
+ ScorerNameTypes | Sequence[ScorerNameTypes]
511
+ | ScorerCallableType | dict[str, ScorerCallableType]
521
512
 
522
513
  RefitCallableType:
523
- Callable[[CVResultsType], numbers.Integral]
514
+ Callable[[CVResultsType], int]
524
515
 
525
516
  RefitType:
526
- Union[bool, ScorerNameTypes, RefitCallableType]
517
+ bool | ScorerNameTypes | RefitCallableType
527
518
 
528
519
  DaskSchedulerType:
529
- Union[distributed.scheduler.Scheduler, distributed.client.Client]
520
+ distributed.scheduler.Scheduler | distributed.client.Client
530
521
 
531
522
  DaskXType:
532
523
  Iterable
533
524
 
534
525
  DaskYType:
535
- Union[Sequence[numbers.Integral], None]
526
+ Sequence[int] | None
536
527
 
537
528
  CVResultsType:
538
529
  dict[str, np.ma.masked_array[Any]]
@@ -590,21 +581,19 @@ class GSTCVDask(_GSTCVMixin):
590
581
  def __init__(
591
582
  self,
592
583
  estimator: ClassifierProtocol,
593
- param_grid: Union[ParamGridInputType, ParamGridsInputType],
584
+ param_grid: ParamGridInputType | ParamGridsInputType,
594
585
  *,
595
- thresholds: ThresholdsInputType=None,
596
- scoring: ScorerInputType='accuracy',
597
- iid: Optional[bool]=True,
598
- refit: Optional[Union[bool, str, Callable]] = True,
599
- cv: Optional[Union[numbers.Integral, Iterable, None]]=None,
600
- verbose: Optional[numbers.Real]=0,
601
- error_score: Optional[ErrorScoreType]='raise',
602
- return_train_score: Optional[bool]=False,
603
- scheduler: Optional[
604
- Union[distributed.Client, distributed.scheduler.Scheduler, None]
605
- ]=None,
606
- n_jobs: Optional[Union[numbers.Integral, None]]=None,
607
- cache_cv: Optional[bool]=True
586
+ thresholds: ThresholdsInputType = None,
587
+ scoring: ScorerInputType = 'accuracy',
588
+ iid:bool = True,
589
+ refit:bool | str | Callable = True,
590
+ cv:int | Iterable | None = None,
591
+ verbose:numbers.Real = 0,
592
+ error_score: ErrorScoreType = 'raise',
593
+ return_train_score:bool = False,
594
+ scheduler: distributed.Client | distributed.scheduler.Scheduler | None=None,
595
+ n_jobs:int | None = None,
596
+ cache_cv:bool = True
608
597
  ) -> None:
609
598
  """Initialize the `GSTCVDask` instance."""
610
599
 
@@ -689,7 +678,7 @@ class GSTCVDask(_GSTCVMixin):
689
678
  else: # _cv is an iterable, _cond_cv should have made list[tuple]
690
679
  self._KFOLD = self._cv
691
680
 
692
- self._CACHE_CV: Union[None, list[DaskSplitType]] = None
681
+ self._CACHE_CV: None | list[DaskSplitType] = None
693
682
  if self.cache_cv:
694
683
  self._CACHE_CV = []
695
684
  for (train_idxs, test_idxs) in self._KFOLD:
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- from typing_extensions import Any
9
+ from typing import Any
10
10
  from .._type_aliases import DaskKFoldType
11
11
 
12
12
  from dask import compute
@@ -6,8 +6,6 @@
6
6
 
7
7
 
8
8
 
9
- from typing_extensions import Union
10
-
11
9
  from .._type_aliases import (
12
10
  DaskSlicerType,
13
11
  DaskSplitType,
@@ -23,7 +21,7 @@ import dask.dataframe as ddf
23
21
  def _fold_splitter(
24
22
  train_idxs: DaskSlicerType,
25
23
  test_idxs: DaskSlicerType,
26
- *data_objects: Union[DaskXType, DaskYType]
24
+ *data_objects: DaskXType | DaskYType
27
25
  ) -> tuple[DaskSplitType, ...]:
28
26
  """Split given data objects into train / test pairs using the given
29
27
  train and test indices.
@@ -44,7 +42,7 @@ def _fold_splitter(
44
42
  test_idxs : DaskSlicerType
45
43
  1D vector of row indices used to slice test sets out of every
46
44
  given data object.
47
- *data_objects : Union[DaskXType, DaskYType]
45
+ *data_objects : DaskXType | DaskYType
48
46
  The data objects to slice. Need not be of equal size, and need
49
47
  not be completely consumed in the train / test splits. However,
50
48
  standard indexing rules apply when slicing by `train_idxs` and
@@ -8,7 +8,6 @@
8
8
 
9
9
  from typing import (
10
10
  Iterator,
11
- Optional
12
11
  )
13
12
  from .._type_aliases import (
14
13
  DaskXType,
@@ -27,7 +26,7 @@ def _get_kfold(
27
26
  _n_splits: int,
28
27
  _iid: bool,
29
28
  _verbose: int,
30
- _y: Optional[DaskYType] = None
29
+ _y: DaskYType | None = None
31
30
  ) -> Iterator[DaskKFoldType]:
32
31
  """Use dask_ml KFold to get train / test splits when cv is passed as
33
32
  an integer.
@@ -64,7 +63,7 @@ def _get_kfold(
64
63
  A number from 0 to 10 indicating the amount of information to
65
64
  display to screen during the grid search trials. 0 means no
66
65
  output, 10 means full output.
67
- _y : Optional[DaskYType]
66
+ _y : DaskYType | None, default = None
68
67
  The target the data is being fit against, to be split in the
69
68
  same way as the data.
70
69
 
@@ -6,10 +6,9 @@
6
6
 
7
7
 
8
8
 
9
- from typing import Literal
10
- from typing_extensions import (
9
+ from typing import (
11
10
  Any,
12
- Union
11
+ Literal
13
12
  )
14
13
  from .._type_aliases import (
15
14
  DaskXType,
@@ -30,7 +29,7 @@ def _parallelized_fit(
30
29
  _y_train: DaskYType,
31
30
  _estimator: ClassifierProtocol,
32
31
  _grid: dict[str, Any],
33
- _error_score: Union[numbers.Real, Literal['raise']],
32
+ _error_score: numbers.Real | Literal['raise'],
34
33
  **_fit_params
35
34
  ) -> tuple[ClassifierProtocol, float, bool]:
36
35
  """Estimator fit method designed for dask parallelism.
@@ -56,7 +55,7 @@ def _parallelized_fit(
56
55
  _grid : dict[str, Any]
57
56
  The hyperparameter values to be used during this fit. One
58
57
  permutation of all the grid search permutations.
59
- _error_score : Union[numbers.Real, Literal['raise']]
58
+ _error_score : numbers.Real | Literal['raise']
60
59
  If a training fold excepts during fitting, the exception can be
61
60
  allowed to raise by passing the 'raise' literal. Otherwise,
62
61
  passing a number-like will cause the exception to be handled,
@@ -6,7 +6,6 @@
6
6
 
7
7
 
8
8
 
9
- from typing_extensions import Union
10
9
  from pybear.model_selection.GSTCV._type_aliases import (
11
10
  ScorerWIPType,
12
11
  ClassifierProtocol,
@@ -35,7 +34,7 @@ def _parallelized_scorer(
35
34
  _f_idx: int,
36
35
  _SCORER_DICT: ScorerWIPType,
37
36
  _THRESHOLDS: ThresholdsWIPType,
38
- _error_score: Union[numbers.Real, None],
37
+ _error_score: numbers.Real | None,
39
38
  _verbose: int
40
39
  ) -> tuple[MaskedHolderType, MaskedHolderType]:
41
40
 
@@ -72,7 +71,7 @@ def _parallelized_scorer(
72
71
  from the mother before building cv_results. This is the vector
73
72
  of thresholds from the mother that also mothered this search
74
73
  permutation.
75
- _error_score : Union[numbers.Real, Literal['raise']]
74
+ _error_score : numbers.Real | Literal['raise']
76
75
  If the training fold complementing this test fold excepted during
77
76
  fitting and `error_score` was set to the 'raise' literal, this
78
77
  module cannot be reached. Otherwise, a number or number-like was
@@ -108,7 +107,7 @@ def _parallelized_scorer(
108
107
  assert isinstance(_SCORER_DICT, dict)
109
108
  assert all(map(callable, _SCORER_DICT.values()))
110
109
  assert isinstance(_THRESHOLDS, list)
111
- assert isinstance(_verbose, (int, float))
110
+ assert isinstance(_verbose, numbers.Real)
112
111
  # END validation ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * *
113
112
 
114
113
  if _verbose >= 5:
@@ -6,7 +6,6 @@
6
6
 
7
7
 
8
8
 
9
- from typing_extensions import Union
10
9
  from pybear.model_selection.GSTCV._type_aliases import (
11
10
  ScorerWIPType,
12
11
  ClassifierProtocol,
@@ -34,7 +33,7 @@ def _parallelized_train_scorer(
34
33
  _f_idx: int,
35
34
  _SCORER_DICT: ScorerWIPType,
36
35
  _BEST_THRESHOLDS_BY_SCORER: NDArrayHolderType,
37
- _error_score: Union[numbers.Real, None],
36
+ _error_score: numbers.Real | None,
38
37
  _verbose: int
39
38
  ) -> MaskedHolderType:
40
39
 
@@ -69,7 +68,7 @@ def _parallelized_train_scorer(
69
68
  score for each scorer is found. This vector has length n_scorers
70
69
  and in each position holds a float indicating the threshold
71
70
  value that is the best threshold for that scorer.
72
- _error_score : Union[numbers.Real, Literal['raise']]
71
+ _error_score : numbers.Real | Literal['raise']
73
72
  If this training fold excepted during fitting and `error_score`
74
73
  was set to the 'raise' literal, this module cannot be reached.
75
74
  Otherwise, a number or number-like was passed to `error_score`.
@@ -105,7 +104,7 @@ def _parallelized_train_scorer(
105
104
  assert isinstance(_SCORER_DICT, dict)
106
105
  assert all(map(callable, _SCORER_DICT.values()))
107
106
  assert isinstance(_BEST_THRESHOLDS_BY_SCORER, np.ndarray)
108
- assert isinstance(_verbose, (int, float))
107
+ assert isinstance(_verbose, numbers.Real)
109
108
  # END validation ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * *
110
109
 
111
110
  if _verbose >= 5:
@@ -6,11 +6,9 @@
6
6
 
7
7
 
8
8
 
9
- from typing_extensions import Union
10
9
  from .._type_aliases import DaskSchedulerType
11
10
 
12
11
  import contextlib
13
- import numbers
14
12
 
15
13
  from distributed import (
16
14
  Client,
@@ -20,8 +18,8 @@ from distributed import (
20
18
 
21
19
 
22
20
  def _cond_scheduler(
23
- _scheduler: Union[DaskSchedulerType, None],
24
- _n_jobs: Union[numbers.Integral, None]
21
+ _scheduler: DaskSchedulerType | None,
22
+ _n_jobs: int | None
25
23
  ) -> DaskSchedulerType:
26
24
  """Set the dask scheduler.
27
25
 
@@ -49,7 +47,7 @@ def _cond_scheduler(
49
47
 
50
48
  Parameters
51
49
  ----------
52
- _scheduler : Union[SchedulerType, None]
50
+ _scheduler : SchedulerType | None
53
51
  _scheduler to be validated and used for compute
54
52
 
55
53
  Returns
@@ -9,14 +9,9 @@
9
9
  from typing import (
10
10
  ContextManager,
11
11
  Iterable,
12
- Sequence
12
+ Sequence,
13
+ TypeAlias
13
14
  )
14
- from typing_extensions import (
15
- TypeAlias,
16
- Union
17
- )
18
-
19
- import numbers
20
15
 
21
16
  import dask
22
17
  import distributed
@@ -24,7 +19,7 @@ import distributed
24
19
 
25
20
 
26
21
  DaskXType: TypeAlias = Iterable
27
- DaskYType: TypeAlias = Union[Sequence[numbers.Integral], None]
22
+ DaskYType: TypeAlias = Sequence[int] | None
28
23
 
29
24
  DaskSlicerType: TypeAlias = dask.array.core.Array
30
25
 
@@ -32,11 +27,12 @@ DaskKFoldType: TypeAlias = tuple[DaskSlicerType, DaskSlicerType]
32
27
 
33
28
  DaskSplitType: TypeAlias = tuple[DaskXType, DaskYType]
34
29
 
35
- DaskSchedulerType: TypeAlias = Union[
36
- distributed.scheduler.Scheduler,
37
- distributed.client.Client,
38
- ContextManager # nullcontext
39
- ]
30
+ DaskSchedulerType: TypeAlias = (
31
+ distributed.scheduler.Scheduler
32
+ | distributed.client.Client
33
+ | ContextManager
34
+ ) # nullcontext
35
+
40
36
 
41
37
 
42
38
 
@@ -18,7 +18,7 @@ import dask.dataframe as ddf
18
18
 
19
19
 
20
20
  def _val_y(
21
- _y: Iterable[numbers.Integral] # not DaskYType... see the notes.
21
+ _y: Iterable[int] # not DaskYType... see the notes.
22
22
  ) -> None:
23
23
  """Validate `_y`.
24
24
 
@@ -7,17 +7,10 @@
7
7
 
8
8
 
9
9
  from typing import (
10
- Optional,
11
- Sequence,
12
- Tuple
13
- )
14
- from typing_extensions import (
15
10
  Any,
16
- Union
11
+ Sequence
17
12
  )
18
13
 
19
- import numbers
20
-
21
14
  from pybear.model_selection.autogridsearch.autogridsearch_wrapper import autogridsearch_wrapper
22
15
  from pybear.model_selection.autogridsearch import autogridsearch_docs
23
16
 
@@ -36,17 +29,17 @@ class AutoGSTCVDask(autogridsearch_wrapper(GSTCVDask)):
36
29
  estimator,
37
30
  params: dict[
38
31
  str,
39
- Sequence[Tuple[
32
+ Sequence[tuple[
40
33
  Sequence[Any],
41
- Union[numbers.Integral, Sequence[numbers.Integral]],
34
+ int | Sequence[int],
42
35
  str
43
36
  ]]
44
37
  ],
45
38
  *,
46
- total_passes:Optional[numbers.Integral] = 5,
47
- total_passes_is_hard:Optional[bool] = False,
48
- max_shifts:Optional[Union[None, numbers.Integral]] = None,
49
- agscv_verbose:Optional[bool] = False,
39
+ total_passes:int = 5,
40
+ total_passes_is_hard:bool = False,
41
+ max_shifts:int | None = None,
42
+ agscv_verbose:bool = False,
50
43
  **parent_gscv_kwargs
51
44
  ):
52
45
 
@@ -7,17 +7,10 @@
7
7
 
8
8
 
9
9
  from typing import (
10
- Optional,
11
- Sequence,
12
- Tuple
13
- )
14
- from typing_extensions import (
15
10
  Any,
16
- Union
11
+ Sequence
17
12
  )
18
13
 
19
- import numbers
20
-
21
14
  from pybear.model_selection import autogridsearch_wrapper
22
15
  from pybear.model_selection.autogridsearch import autogridsearch_docs
23
16
 
@@ -34,19 +27,12 @@ class AutoGridSearchCVDask(autogridsearch_wrapper(dask_GridSearchCV)):
34
27
  def __init__(
35
28
  self,
36
29
  estimator,
37
- params: dict[
38
- str,
39
- Sequence[Tuple[
40
- Sequence[Any],
41
- Union[numbers.Integral, Sequence[numbers.Integral]],
42
- str
43
- ]]
44
- ],
30
+ params: dict[str, Sequence[tuple[Sequence[Any], int | Sequence[int], str]]],
45
31
  *,
46
- total_passes:Optional[numbers.Integral] = 5,
47
- total_passes_is_hard:Optional[bool] = False,
48
- max_shifts:Optional[Union[None, numbers.Integral]] = None,
49
- agscv_verbose:Optional[bool] = False,
32
+ total_passes:int = 5,
33
+ total_passes_is_hard:bool = False,
34
+ max_shifts:int | None = None,
35
+ agscv_verbose:bool = False,
50
36
  **parent_gscv_kwargs
51
37
  ):
52
38