scikit-base 0.9.0__tar.gz → 0.10.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.
- {scikit_base-0.9.0/scikit_base.egg-info → scikit_base-0.10.1}/PKG-INFO +6 -5
- {scikit_base-0.9.0 → scikit_base-0.10.1}/README.md +1 -1
- {scikit_base-0.9.0 → scikit_base-0.10.1}/pyproject.toml +5 -4
- {scikit_base-0.9.0 → scikit_base-0.10.1/scikit_base.egg-info}/PKG-INFO +6 -5
- {scikit_base-0.9.0 → scikit_base-0.10.1}/scikit_base.egg-info/requires.txt +5 -1
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/__init__.py +1 -1
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/base/_base.py +86 -38
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/base/_pretty_printing/tests/test_pprint.py +7 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/testing/test_all_objects.py +5 -1
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/tests/test_base.py +6 -6
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/dependencies/_dependencies.py +0 -18
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/tests/test_deep_equals.py +3 -9
- {scikit_base-0.9.0 → scikit_base-0.10.1}/LICENSE +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/docs/source/conf.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/scikit_base.egg-info/SOURCES.txt +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/scikit_base.egg-info/dependency_links.txt +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/scikit_base.egg-info/top_level.txt +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/scikit_base.egg-info/zip-safe +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/setup.cfg +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/_exceptions.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/_nopytest_tests.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/base/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/base/_meta.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/base/_pretty_printing/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/base/_pretty_printing/_object_html_repr.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/base/_pretty_printing/_pprint.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/base/_pretty_printing/tests/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/base/_tagmanager.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/lookup/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/lookup/_lookup.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/lookup/tests/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/lookup/tests/test_lookup.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/testing/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/testing/utils/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/testing/utils/_conditional_fixtures.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/testing/utils/inspect.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/tests/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/tests/conftest.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/tests/mock_package/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/tests/mock_package/test_mock_package.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/tests/test_baseestimator.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/tests/test_exceptions.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/tests/test_meta.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/_check.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/_iter.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/_nested_iter.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/_utils.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/deep_equals/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/deep_equals/_common.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/deep_equals/_deep_equals.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/dependencies/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/dependencies/tests/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/dependencies/tests/test_check_dependencies.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/random_state.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/stderr_mute.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/stdout_mute.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/tests/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/tests/test_check.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/tests/test_iter.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/tests/test_nested_iter.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/tests/test_random_state.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/tests/test_std_mute.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/tests/test_utils.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/validate/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/validate/_named_objects.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/validate/_types.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/validate/tests/__init__.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/validate/tests/test_iterable_named_objects.py +0 -0
- {scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/validate/tests/test_type_validations.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: scikit-base
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.10.1
|
4
4
|
Summary: Base classes for sklearn-like parametric objects
|
5
5
|
Author-email: sktime developers <sktime.toolbox@gmail.com>
|
6
6
|
Maintainer: Franz Király
|
@@ -55,14 +55,15 @@ Classifier: Programming Language :: Python :: 3.9
|
|
55
55
|
Classifier: Programming Language :: Python :: 3.10
|
56
56
|
Classifier: Programming Language :: Python :: 3.11
|
57
57
|
Classifier: Programming Language :: Python :: 3.12
|
58
|
-
|
58
|
+
Classifier: Programming Language :: Python :: 3.13
|
59
|
+
Requires-Python: <3.14,>=3.8
|
59
60
|
Description-Content-Type: text/markdown
|
60
61
|
License-File: LICENSE
|
61
62
|
Provides-Extra: all-extras
|
62
63
|
Requires-Dist: numpy; extra == "all-extras"
|
63
64
|
Requires-Dist: pandas; extra == "all-extras"
|
64
65
|
Provides-Extra: dev
|
65
|
-
Requires-Dist: scikit-learn>=0.24.0; extra == "dev"
|
66
|
+
Requires-Dist: scikit-learn>=0.24.0; (python_version < "3.13" or sys_platform != "win32") and extra == "dev"
|
66
67
|
Requires-Dist: pre-commit; extra == "dev"
|
67
68
|
Requires-Dist: pytest; extra == "dev"
|
68
69
|
Requires-Dist: pytest-cov; extra == "dev"
|
@@ -103,7 +104,7 @@ Requires-Dist: safety; extra == "test"
|
|
103
104
|
Requires-Dist: numpy; extra == "test"
|
104
105
|
Requires-Dist: scipy; extra == "test"
|
105
106
|
Requires-Dist: pandas; extra == "test"
|
106
|
-
Requires-Dist: scikit-learn>=0.24.0; extra == "test"
|
107
|
+
Requires-Dist: scikit-learn>=0.24.0; (python_version < "3.13" or sys_platform != "win32") and extra == "test"
|
107
108
|
|
108
109
|
<a href="https://skbase.readthedocs.io/en/latest/"><img src="https://github.com/sktime/skbase/blob/main/docs/source/images/skbase-logo-with-name.png" width="175" align="right" /></a>
|
109
110
|
|
@@ -114,7 +115,7 @@ Requires-Dist: scikit-learn>=0.24.0; extra == "test"
|
|
114
115
|
`skbase` provides base classes for creating scikit-learn-like parametric objects,
|
115
116
|
along with tools to make it easier to build your own packages that follow these design patterns.
|
116
117
|
|
117
|
-
:rocket: Version 0.
|
118
|
+
:rocket: Version 0.10.1 is now available. Check out our
|
118
119
|
[release notes](https://skbase.readthedocs.io/en/latest/changelog.html).
|
119
120
|
|
120
121
|
| Overview | |
|
@@ -7,7 +7,7 @@
|
|
7
7
|
`skbase` provides base classes for creating scikit-learn-like parametric objects,
|
8
8
|
along with tools to make it easier to build your own packages that follow these design patterns.
|
9
9
|
|
10
|
-
:rocket: Version 0.
|
10
|
+
:rocket: Version 0.10.1 is now available. Check out our
|
11
11
|
[release notes](https://skbase.readthedocs.io/en/latest/changelog.html).
|
12
12
|
|
13
13
|
| Overview | |
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "scikit-base"
|
3
|
-
version = "0.
|
3
|
+
version = "0.10.1"
|
4
4
|
description = "Base classes for sklearn-like parametric objects"
|
5
5
|
authors = [
|
6
6
|
{name = "sktime developers", email = "sktime.toolbox@gmail.com"},
|
@@ -31,15 +31,16 @@ classifiers = [
|
|
31
31
|
"Programming Language :: Python :: 3.10",
|
32
32
|
"Programming Language :: Python :: 3.11",
|
33
33
|
"Programming Language :: Python :: 3.12",
|
34
|
+
"Programming Language :: Python :: 3.13",
|
34
35
|
]
|
35
|
-
requires-python = ">=3.8,<3.
|
36
|
+
requires-python = ">=3.8,<3.14"
|
36
37
|
dependencies = []
|
37
38
|
|
38
39
|
[project.optional-dependencies]
|
39
40
|
all_extras = ["numpy", "pandas"]
|
40
41
|
|
41
42
|
dev = [
|
42
|
-
|
43
|
+
'scikit-learn>=0.24.0; python_version < "3.13" or sys_platform != "win32"', # todo 0.11.0 - check if windows 3.13 works, if yes, remove markers
|
43
44
|
"pre-commit",
|
44
45
|
"pytest",
|
45
46
|
"pytest-cov"
|
@@ -86,7 +87,7 @@ test = [
|
|
86
87
|
"numpy",
|
87
88
|
"scipy",
|
88
89
|
"pandas",
|
89
|
-
|
90
|
+
'scikit-learn>=0.24.0; python_version < "3.13" or sys_platform != "win32"', # todo 0.11.0 - check if windows 3.13 works, if yes, remove markers
|
90
91
|
]
|
91
92
|
|
92
93
|
[project.urls]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: scikit-base
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.10.1
|
4
4
|
Summary: Base classes for sklearn-like parametric objects
|
5
5
|
Author-email: sktime developers <sktime.toolbox@gmail.com>
|
6
6
|
Maintainer: Franz Király
|
@@ -55,14 +55,15 @@ Classifier: Programming Language :: Python :: 3.9
|
|
55
55
|
Classifier: Programming Language :: Python :: 3.10
|
56
56
|
Classifier: Programming Language :: Python :: 3.11
|
57
57
|
Classifier: Programming Language :: Python :: 3.12
|
58
|
-
|
58
|
+
Classifier: Programming Language :: Python :: 3.13
|
59
|
+
Requires-Python: <3.14,>=3.8
|
59
60
|
Description-Content-Type: text/markdown
|
60
61
|
License-File: LICENSE
|
61
62
|
Provides-Extra: all-extras
|
62
63
|
Requires-Dist: numpy; extra == "all-extras"
|
63
64
|
Requires-Dist: pandas; extra == "all-extras"
|
64
65
|
Provides-Extra: dev
|
65
|
-
Requires-Dist: scikit-learn>=0.24.0; extra == "dev"
|
66
|
+
Requires-Dist: scikit-learn>=0.24.0; (python_version < "3.13" or sys_platform != "win32") and extra == "dev"
|
66
67
|
Requires-Dist: pre-commit; extra == "dev"
|
67
68
|
Requires-Dist: pytest; extra == "dev"
|
68
69
|
Requires-Dist: pytest-cov; extra == "dev"
|
@@ -103,7 +104,7 @@ Requires-Dist: safety; extra == "test"
|
|
103
104
|
Requires-Dist: numpy; extra == "test"
|
104
105
|
Requires-Dist: scipy; extra == "test"
|
105
106
|
Requires-Dist: pandas; extra == "test"
|
106
|
-
Requires-Dist: scikit-learn>=0.24.0; extra == "test"
|
107
|
+
Requires-Dist: scikit-learn>=0.24.0; (python_version < "3.13" or sys_platform != "win32") and extra == "test"
|
107
108
|
|
108
109
|
<a href="https://skbase.readthedocs.io/en/latest/"><img src="https://github.com/sktime/skbase/blob/main/docs/source/images/skbase-logo-with-name.png" width="175" align="right" /></a>
|
109
110
|
|
@@ -114,7 +115,7 @@ Requires-Dist: scikit-learn>=0.24.0; extra == "test"
|
|
114
115
|
`skbase` provides base classes for creating scikit-learn-like parametric objects,
|
115
116
|
along with tools to make it easier to build your own packages that follow these design patterns.
|
116
117
|
|
117
|
-
:rocket: Version 0.
|
118
|
+
:rocket: Version 0.10.1 is now available. Check out our
|
118
119
|
[release notes](https://skbase.readthedocs.io/en/latest/changelog.html).
|
119
120
|
|
120
121
|
| Overview | |
|
@@ -7,11 +7,13 @@ pandas
|
|
7
7
|
jupyter
|
8
8
|
|
9
9
|
[dev]
|
10
|
-
scikit-learn>=0.24.0
|
11
10
|
pre-commit
|
12
11
|
pytest
|
13
12
|
pytest-cov
|
14
13
|
|
14
|
+
[dev:python_version < "3.13" or sys_platform != "win32"]
|
15
|
+
scikit-learn>=0.24.0
|
16
|
+
|
15
17
|
[docs]
|
16
18
|
jupyter
|
17
19
|
myst-parser
|
@@ -49,4 +51,6 @@ safety
|
|
49
51
|
numpy
|
50
52
|
scipy
|
51
53
|
pandas
|
54
|
+
|
55
|
+
[test:python_version < "3.13" or sys_platform != "win32"]
|
52
56
|
scikit-learn>=0.24.0
|
@@ -31,8 +31,8 @@ Tag inspection and setter methods
|
|
31
31
|
set/clone dynamic tags - clone_tags(estimator, tag_names=None)
|
32
32
|
|
33
33
|
Blueprinting: resetting and cloning, post-init state with same hyper-parameters
|
34
|
-
reset
|
35
|
-
|
34
|
+
reset object to post-init - reset()
|
35
|
+
clone object (copy&reset) - clone()
|
36
36
|
|
37
37
|
Testing with default parameters methods
|
38
38
|
getting default parameters (all sets) - get_test_params()
|
@@ -144,10 +144,10 @@ class BaseObject(_FlagManager):
|
|
144
144
|
return self
|
145
145
|
|
146
146
|
def clone(self):
|
147
|
-
"""Obtain a clone of the object with same hyper-parameters.
|
147
|
+
"""Obtain a clone of the object with same hyper-parameters and config.
|
148
148
|
|
149
149
|
A clone is a different object without shared references, in post-init state.
|
150
|
-
This function is equivalent to returning sklearn.clone of self
|
150
|
+
This function is equivalent to returning ``sklearn.clone`` of ``self``.
|
151
151
|
|
152
152
|
Raises
|
153
153
|
------
|
@@ -197,7 +197,7 @@ class BaseObject(_FlagManager):
|
|
197
197
|
for p in parameters:
|
198
198
|
if p.kind == p.VAR_POSITIONAL:
|
199
199
|
raise RuntimeError(
|
200
|
-
"scikit-
|
200
|
+
"scikit-base compatible classes should always "
|
201
201
|
"specify their parameters in the signature"
|
202
202
|
" of their __init__ (no varargs)."
|
203
203
|
" %s with constructor %s doesn't "
|
@@ -290,7 +290,7 @@ class BaseObject(_FlagManager):
|
|
290
290
|
def set_params(self, **params):
|
291
291
|
"""Set the parameters of this object.
|
292
292
|
|
293
|
-
The method works on simple
|
293
|
+
The method works on simple skbase objects as well as on composite objects.
|
294
294
|
Parameter key strings ``<component>__<parameter>`` can be used for composites,
|
295
295
|
i.e., objects that contain other objects, to access ``<parameter>`` in
|
296
296
|
the component ``<component>``.
|
@@ -333,7 +333,7 @@ class BaseObject(_FlagManager):
|
|
333
333
|
valid_params[key] = value
|
334
334
|
|
335
335
|
# all matched params have now been set
|
336
|
-
# reset
|
336
|
+
# reset object to clean post-init state with those params
|
337
337
|
self.reset()
|
338
338
|
|
339
339
|
# recurse in components
|
@@ -460,7 +460,7 @@ class BaseObject(_FlagManager):
|
|
460
460
|
)
|
461
461
|
|
462
462
|
def get_tags(self):
|
463
|
-
"""Get tags from
|
463
|
+
"""Get tags from skbase class and dynamic tag overrides.
|
464
464
|
|
465
465
|
Returns
|
466
466
|
-------
|
@@ -472,7 +472,7 @@ class BaseObject(_FlagManager):
|
|
472
472
|
return self._get_flags(flag_attr_name="_tags")
|
473
473
|
|
474
474
|
def get_tag(self, tag_name, tag_value_default=None, raise_error=True):
|
475
|
-
"""Get tag value from
|
475
|
+
"""Get tag value from object class and dynamic tag overrides.
|
476
476
|
|
477
477
|
Parameters
|
478
478
|
----------
|
@@ -523,11 +523,11 @@ class BaseObject(_FlagManager):
|
|
523
523
|
return self
|
524
524
|
|
525
525
|
def clone_tags(self, estimator, tag_names=None):
|
526
|
-
"""Clone tags from another
|
526
|
+
"""Clone tags from another object as dynamic override.
|
527
527
|
|
528
528
|
Parameters
|
529
529
|
----------
|
530
|
-
estimator :
|
530
|
+
estimator : An instance of :class:BaseObject or derived class
|
531
531
|
tag_names : str or list of str, default = None
|
532
532
|
Names of tags to clone. If None then all tags in estimator are used
|
533
533
|
as `tag_names`.
|
@@ -582,7 +582,7 @@ class BaseObject(_FlagManager):
|
|
582
582
|
|
583
583
|
@classmethod
|
584
584
|
def get_test_params(cls, parameter_set="default"):
|
585
|
-
"""Return testing parameter settings for the
|
585
|
+
"""Return testing parameter settings for the skbase object.
|
586
586
|
|
587
587
|
Parameters
|
588
588
|
----------
|
@@ -605,7 +605,7 @@ class BaseObject(_FlagManager):
|
|
605
605
|
# if non-default parameters are required, but none have been found, raise error
|
606
606
|
if len(params_without_defaults) > 0:
|
607
607
|
raise ValueError(
|
608
|
-
f"
|
608
|
+
f"skbase object {cls} has parameters without default values, "
|
609
609
|
f"but these are not set in get_test_params. "
|
610
610
|
f"Please set them in get_test_params, or provide default values. "
|
611
611
|
f"Also see the respective extension template, if applicable."
|
@@ -618,7 +618,7 @@ class BaseObject(_FlagManager):
|
|
618
618
|
|
619
619
|
@classmethod
|
620
620
|
def create_test_instance(cls, parameter_set="default"):
|
621
|
-
"""Construct
|
621
|
+
"""Construct an instance of the class, using first test parameter set.
|
622
622
|
|
623
623
|
Parameters
|
624
624
|
----------
|
@@ -904,18 +904,18 @@ class BaseObject(_FlagManager):
|
|
904
904
|
def set_random_state(self, random_state=None, deep=True, self_policy="copy"):
|
905
905
|
"""Set random_state pseudo-random seed parameters for self.
|
906
906
|
|
907
|
-
Finds ``random_state`` named parameters via ``
|
907
|
+
Finds ``random_state`` named parameters via ``self.get_params``,
|
908
908
|
and sets them to integers derived from ``random_state`` via ``set_params``.
|
909
909
|
These integers are sampled from chain hashing via ``sample_dependent_seed``,
|
910
910
|
and guarantee pseudo-random independence of seeded random generators.
|
911
911
|
|
912
|
-
Applies to ``random_state`` parameters in ``
|
913
|
-
``self_policy``, and remaining component
|
912
|
+
Applies to ``random_state`` parameters in ``self``, depending on
|
913
|
+
``self_policy``, and remaining component objects
|
914
914
|
if and only if ``deep=True``.
|
915
915
|
|
916
916
|
Note: calls ``set_params`` even if ``self`` does not have a ``random_state``,
|
917
917
|
or none of the components have a ``random_state`` parameter.
|
918
|
-
Therefore, ``set_random_state`` will reset any ``scikit-base``
|
918
|
+
Therefore, ``set_random_state`` will reset any ``scikit-base`` object,
|
919
919
|
even those without a ``random_state`` parameter.
|
920
920
|
|
921
921
|
Parameters
|
@@ -925,15 +925,18 @@ class BaseObject(_FlagManager):
|
|
925
925
|
integers. Pass int for reproducible output across multiple function calls.
|
926
926
|
|
927
927
|
deep : bool, default=True
|
928
|
-
Whether to set the random state in
|
929
|
-
|
930
|
-
|
928
|
+
Whether to set the random state in skbase object valued parameters, i.e.,
|
929
|
+
component estimators.
|
930
|
+
|
931
|
+
* If False, will set only ``self``'s ``random_state`` parameter, if exists.
|
932
|
+
* If True, will set ``random_state`` parameters in component objects
|
933
|
+
as well.
|
931
934
|
|
932
935
|
self_policy : str, one of {"copy", "keep", "new"}, default="copy"
|
933
936
|
|
934
|
-
* "copy" : ``
|
935
|
-
* "keep" : ``
|
936
|
-
* "new" : ``
|
937
|
+
* "copy" : ``self.random_state`` is set to input ``random_state``
|
938
|
+
* "keep" : ``self.random_state`` is kept as is
|
939
|
+
* "new" : ``self.random_state`` is set to a new random state,
|
937
940
|
derived from input ``random_state``, and in general different from it
|
938
941
|
|
939
942
|
Returns
|
@@ -985,7 +988,21 @@ class TagAliaserMixin:
|
|
985
988
|
|
986
989
|
@classmethod
|
987
990
|
def get_class_tags(cls):
|
988
|
-
"""Get class tags from
|
991
|
+
"""Get class tags from class, with tag level inheritance from parent classes.
|
992
|
+
|
993
|
+
Every ``scikit-base`` compatible class has a set of tags,
|
994
|
+
which are used to store metadata about the object.
|
995
|
+
|
996
|
+
This is a class method, and retrieves tags applicable to the class,
|
997
|
+
with tag level overrides in the following order of decreasing priority:
|
998
|
+
|
999
|
+
1. class tags of the class, of which the object is an instance
|
1000
|
+
2. class tags of all parent classes, in method resolution order
|
1001
|
+
|
1002
|
+
Instances can override these tags depending on hyper-parameters.
|
1003
|
+
|
1004
|
+
To retrieve tags with potential instance overrides, use
|
1005
|
+
the ``get_tags`` method instead.
|
989
1006
|
|
990
1007
|
Returns
|
991
1008
|
-------
|
@@ -1000,7 +1017,22 @@ class TagAliaserMixin:
|
|
1000
1017
|
|
1001
1018
|
@classmethod
|
1002
1019
|
def get_class_tag(cls, tag_name, tag_value_default=None):
|
1003
|
-
"""Get tag value from
|
1020
|
+
"""Get class tag value from class, with tag level inheritance from parents.
|
1021
|
+
|
1022
|
+
Every ``scikit-base`` compatible class has a set of tags,
|
1023
|
+
which are used to store metadata about the object.
|
1024
|
+
|
1025
|
+
This is a class method, and retrieves the value of a tag applicable
|
1026
|
+
to the class,
|
1027
|
+
with tag level overrides in the following order of decreasing priority:
|
1028
|
+
|
1029
|
+
1. class tags of the class, of which the object is an instance
|
1030
|
+
2. class tags of all parent classes, in method resolution order
|
1031
|
+
|
1032
|
+
Instances can override these tags depending on hyper-parameters.
|
1033
|
+
|
1034
|
+
To retrieve tag values with potential instance overrides, use
|
1035
|
+
the ``get_tag`` method instead.
|
1004
1036
|
|
1005
1037
|
Parameters
|
1006
1038
|
----------
|
@@ -1021,7 +1053,17 @@ class TagAliaserMixin:
|
|
1021
1053
|
)
|
1022
1054
|
|
1023
1055
|
def get_tags(self):
|
1024
|
-
"""Get tags from
|
1056
|
+
"""Get tags from instance, with tag level inheritance and overrides.
|
1057
|
+
|
1058
|
+
Every ``scikit-base`` compatible object has a set of tags,
|
1059
|
+
which are used to store metadata about the object.
|
1060
|
+
|
1061
|
+
This method retrieves all tags as a dictionary, with tag level overrides in the
|
1062
|
+
following order of decreasing priority:
|
1063
|
+
|
1064
|
+
1. dynamic tags set at construction, e.g., dependent on hyper-parameters
|
1065
|
+
2. class tags of the class, of which the object is an instance
|
1066
|
+
3. class tags of all parent classes, in method resolution order
|
1025
1067
|
|
1026
1068
|
Returns
|
1027
1069
|
-------
|
@@ -1035,7 +1077,17 @@ class TagAliaserMixin:
|
|
1035
1077
|
return collected_tags
|
1036
1078
|
|
1037
1079
|
def get_tag(self, tag_name, tag_value_default=None, raise_error=True):
|
1038
|
-
"""Get tag value from
|
1080
|
+
"""Get tag value from instance, with tag level inheritance and overrides.
|
1081
|
+
|
1082
|
+
Every ``scikit-base`` compatible object has a set of tags,
|
1083
|
+
which are used to store metadata about the object.
|
1084
|
+
|
1085
|
+
This method retrieves the value of a single tag, with tag level overrides in the
|
1086
|
+
following order of decreasing priority:
|
1087
|
+
|
1088
|
+
1. dynamic tags set at construction, e.g., dependent on hyper-parameters
|
1089
|
+
2. class tags of the class, of which the object is an instance
|
1090
|
+
3. class tags of all parent classes, in method resolution order
|
1039
1091
|
|
1040
1092
|
Parameters
|
1041
1093
|
----------
|
@@ -1231,19 +1283,13 @@ class BaseEstimator(BaseObject):
|
|
1231
1283
|
if not deep:
|
1232
1284
|
return fitted_params
|
1233
1285
|
|
1234
|
-
def sh(x):
|
1235
|
-
"""Shorthand to remove all underscores at end of a string."""
|
1236
|
-
if x.endswith("_"):
|
1237
|
-
return sh(x[:-1])
|
1238
|
-
else:
|
1239
|
-
return x
|
1240
|
-
|
1241
1286
|
# add all nested parameters from components that are skbase BaseEstimator
|
1242
1287
|
c_dict = self._components()
|
1243
1288
|
for c, comp in c_dict.items():
|
1244
1289
|
if isinstance(comp, BaseEstimator) and comp._is_fitted:
|
1245
1290
|
c_f_params = comp.get_fitted_params(deep=deep)
|
1246
|
-
|
1291
|
+
c = c.rstrip("_")
|
1292
|
+
c_f_params = {f"{c}__{k}": v for k, v in c_f_params.items()}
|
1247
1293
|
fitted_params.update(c_f_params)
|
1248
1294
|
|
1249
1295
|
# add all nested parameters from components that are sklearn estimators
|
@@ -1256,7 +1302,8 @@ class BaseEstimator(BaseObject):
|
|
1256
1302
|
for c, comp in old_new_params.items():
|
1257
1303
|
if isinstance(comp, self.GET_FITTED_PARAMS_NESTING):
|
1258
1304
|
c_f_params = self._get_fitted_params_default(comp)
|
1259
|
-
|
1305
|
+
c = c.rstrip("_")
|
1306
|
+
c_f_params = {f"{c}__{k}": v for k, v in c_f_params.items()}
|
1260
1307
|
new_params.update(c_f_params)
|
1261
1308
|
fitted_params.update(new_params)
|
1262
1309
|
old_new_params = new_params.copy()
|
@@ -1384,7 +1431,8 @@ def _clone(estimator, *, safe=True):
|
|
1384
1431
|
found in :ref:`randomness`.
|
1385
1432
|
"""
|
1386
1433
|
estimator_type = type(estimator)
|
1387
|
-
|
1434
|
+
if estimator_type is dict:
|
1435
|
+
return {k: _clone(v, safe=safe) for k, v in estimator.items()}
|
1388
1436
|
if estimator_type in (list, tuple, set, frozenset):
|
1389
1437
|
return estimator_type([_clone(e, safe=safe) for e in estimator])
|
1390
1438
|
elif not hasattr(estimator, "get_params") or isinstance(estimator, type):
|
@@ -2,7 +2,10 @@
|
|
2
2
|
# copyright: skbase developers, BSD-3-Clause License (see LICENSE file)
|
3
3
|
"""Tests for skbase pretty printing functionality."""
|
4
4
|
|
5
|
+
import pytest
|
6
|
+
|
5
7
|
from skbase.base import BaseObject
|
8
|
+
from skbase.utils.dependencies import _check_soft_dependencies
|
6
9
|
|
7
10
|
|
8
11
|
class CompositionDummy(BaseObject):
|
@@ -15,6 +18,10 @@ class CompositionDummy(BaseObject):
|
|
15
18
|
super(CompositionDummy, self).__init__()
|
16
19
|
|
17
20
|
|
21
|
+
@pytest.mark.skipif(
|
22
|
+
not _check_soft_dependencies("scikit-learn", severity="none"),
|
23
|
+
reason="skip test if sklearn is not available",
|
24
|
+
) # sklearn is part of the dev dependency set, test should be executed with that
|
18
25
|
def test_sklearn_compatibility():
|
19
26
|
"""Test that the pretty printing functions are compatible with sklearn."""
|
20
27
|
from sklearn.ensemble import RandomForestRegressor
|
@@ -736,9 +736,13 @@ class TestAllObjects(BaseFixtureGenerator, QuickTester):
|
|
736
736
|
assert not obj_clone.is_fitted
|
737
737
|
|
738
738
|
def test_repr(self, object_instance):
|
739
|
-
"""Check
|
739
|
+
"""Check that __repr__ call to instance does not raise exceptions."""
|
740
740
|
repr(object_instance)
|
741
741
|
|
742
|
+
def test_repr_html(self, object_instance):
|
743
|
+
"""Check that _repr_html_ call to instance does not raise exceptions."""
|
744
|
+
object_instance._repr_html_()
|
745
|
+
|
742
746
|
def test_constructor(self, object_class):
|
743
747
|
"""Check that the constructor has sklearn compatible signature and behaviour.
|
744
748
|
|
@@ -1022,7 +1022,7 @@ def test_nested_config_after_clone_tags(clone_config):
|
|
1022
1022
|
|
1023
1023
|
|
1024
1024
|
@pytest.mark.skipif(
|
1025
|
-
not _check_soft_dependencies("
|
1025
|
+
not _check_soft_dependencies("scikit-learn", severity="none"),
|
1026
1026
|
reason="skip test if sklearn is not available",
|
1027
1027
|
) # sklearn is part of the dev dependency set, test should be executed with that
|
1028
1028
|
def test_clone_param_is_none(fixture_class_parent: Type[Parent]):
|
@@ -1037,7 +1037,7 @@ def test_clone_param_is_none(fixture_class_parent: Type[Parent]):
|
|
1037
1037
|
|
1038
1038
|
|
1039
1039
|
@pytest.mark.skipif(
|
1040
|
-
not _check_soft_dependencies("
|
1040
|
+
not _check_soft_dependencies("scikit-learn", severity="none"),
|
1041
1041
|
reason="skip test if sklearn is not available",
|
1042
1042
|
) # sklearn is part of the dev dependency set, test should be executed with that
|
1043
1043
|
def test_clone_empty_array(fixture_class_parent: Type[Parent]):
|
@@ -1057,7 +1057,7 @@ def test_clone_empty_array(fixture_class_parent: Type[Parent]):
|
|
1057
1057
|
|
1058
1058
|
|
1059
1059
|
@pytest.mark.skipif(
|
1060
|
-
not _check_soft_dependencies("
|
1060
|
+
not _check_soft_dependencies("scikit-learn", severity="none"),
|
1061
1061
|
reason="skip test if sklearn is not available",
|
1062
1062
|
) # sklearn is part of the dev dependency set, test should be executed with that
|
1063
1063
|
def test_clone_sparse_matrix(fixture_class_parent: Type[Parent]):
|
@@ -1076,7 +1076,7 @@ def test_clone_sparse_matrix(fixture_class_parent: Type[Parent]):
|
|
1076
1076
|
|
1077
1077
|
|
1078
1078
|
@pytest.mark.skipif(
|
1079
|
-
not _check_soft_dependencies("
|
1079
|
+
not _check_soft_dependencies("scikit-learn", severity="none"),
|
1080
1080
|
reason="skip test if sklearn is not available",
|
1081
1081
|
) # sklearn is part of the dev dependency set, test should be executed with that
|
1082
1082
|
def test_clone_nan(fixture_class_parent: Type[Parent]):
|
@@ -1105,7 +1105,7 @@ def test_clone_estimator_types(fixture_class_parent: Type[Parent]):
|
|
1105
1105
|
|
1106
1106
|
|
1107
1107
|
@pytest.mark.skipif(
|
1108
|
-
not _check_soft_dependencies("
|
1108
|
+
not _check_soft_dependencies("scikit-learn", severity="none"),
|
1109
1109
|
reason="skip test if sklearn is not available",
|
1110
1110
|
) # sklearn is part of the dev dependency set, test should be executed with that
|
1111
1111
|
def test_clone_class_rather_than_instance_raises_error(
|
@@ -1120,7 +1120,7 @@ def test_clone_class_rather_than_instance_raises_error(
|
|
1120
1120
|
|
1121
1121
|
|
1122
1122
|
@pytest.mark.skipif(
|
1123
|
-
not _check_soft_dependencies("
|
1123
|
+
not _check_soft_dependencies("scikit-learn", severity="none"),
|
1124
1124
|
reason="skip test if sklearn is not available",
|
1125
1125
|
) # sklearn is part of the dev dependency set, test should be executed with that
|
1126
1126
|
def test_clone_sklearn_composite(fixture_class_parent: Type[Parent]):
|
@@ -11,14 +11,12 @@ from packaging.specifiers import InvalidSpecifier, Specifier, SpecifierSet
|
|
11
11
|
from packaging.version import InvalidVersion, Version
|
12
12
|
|
13
13
|
|
14
|
-
# todo 0.10.0: remove suppress_import_stdout argument
|
15
14
|
def _check_soft_dependencies(
|
16
15
|
*packages,
|
17
16
|
package_import_alias="deprecated",
|
18
17
|
severity="error",
|
19
18
|
obj=None,
|
20
19
|
msg=None,
|
21
|
-
suppress_import_stdout="deprecated",
|
22
20
|
):
|
23
21
|
"""Check if required soft dependencies are installed and raise error or warning.
|
24
22
|
|
@@ -68,22 +66,6 @@ def _check_soft_dependencies(
|
|
68
66
|
-------
|
69
67
|
boolean - whether all packages are installed, only if no exception is raised
|
70
68
|
"""
|
71
|
-
# todo 0.10.0: remove this warning
|
72
|
-
if suppress_import_stdout != "deprecated":
|
73
|
-
warnings.warn(
|
74
|
-
"In skbase _check_soft_dependencies, the suppress_import_stdout argument "
|
75
|
-
"is deprecated and no longer has any effect. "
|
76
|
-
"The argument will be removed in version 0.10.0, so users of the "
|
77
|
-
"_check_soft_dependencies utility should not pass this argument anymore. "
|
78
|
-
"The _check_soft_dependencies utility also no longer causes imports, "
|
79
|
-
"hence no stdout "
|
80
|
-
"output is created from imports, for any setting of the "
|
81
|
-
"suppress_import_stdout argument. If you wish to import packages "
|
82
|
-
"and make use of stdout prints, import the package directly instead.",
|
83
|
-
DeprecationWarning,
|
84
|
-
stacklevel=2,
|
85
|
-
)
|
86
|
-
|
87
69
|
if len(packages) == 1 and isinstance(packages[0], (tuple, list)):
|
88
70
|
packages = packages[0]
|
89
71
|
if not all(isinstance(x, str) for x in packages):
|
@@ -71,9 +71,7 @@ if _check_soft_dependencies("pandas", severity="none"):
|
|
71
71
|
|
72
72
|
EXAMPLES += [X]
|
73
73
|
|
74
|
-
if _check_soft_dependencies(
|
75
|
-
"scikit-learn", package_import_alias={"scikit-learn": "sklearn"}, severity="none"
|
76
|
-
):
|
74
|
+
if _check_soft_dependencies("scikit-learn", severity="none"):
|
77
75
|
from sklearn.ensemble import RandomForestRegressor
|
78
76
|
|
79
77
|
EXAMPLES += [RandomForestRegressor()]
|
@@ -115,16 +113,12 @@ def test_deep_equals_negative(fixture1, fixture2):
|
|
115
113
|
def copy_except_if_sklearn(obj):
|
116
114
|
"""Copy obj if it is not a scikit-learn estimator.
|
117
115
|
|
118
|
-
We use this
|
116
|
+
We use this function as deep_copy should return True for
|
119
117
|
identical sklearn estimators, but False for different copies.
|
120
118
|
|
121
119
|
This is the current status quo, possibly we want to change this in the future.
|
122
120
|
"""
|
123
|
-
if not _check_soft_dependencies(
|
124
|
-
"scikit-learn",
|
125
|
-
package_import_alias={"scikit-learn": "sklearn"},
|
126
|
-
severity="none",
|
127
|
-
):
|
121
|
+
if not _check_soft_dependencies("scikit-learn", severity="none"):
|
128
122
|
return deepcopy(obj)
|
129
123
|
else:
|
130
124
|
from sklearn.base import BaseEstimator
|
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
|
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
|
{scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/utils/dependencies/tests/test_check_dependencies.py
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
|
{scikit_base-0.9.0 → scikit_base-0.10.1}/skbase/validate/tests/test_iterable_named_objects.py
RENAMED
File without changes
|
File without changes
|