Skip to content

Commit 63dda95

Browse files
[Doc] A fix to inconsistent ticks in Base module (#2734)
* A fix to inconsistent ticks in Base module * A fix to inconsistent ticks in Base module * A fix to inconsistent ticks in Base module * Revert "A fix to inconsistent ticks in Base module" This reverts commit 56704c2. * inconsistent backticks in base module * Revert "inconsistent backticks in base module" This reverts commit d4f98bd644c17b49fee6d7388d2ac63d1ab59a5e. * fix inconsistent ticks in base module * A fix to inconsistent ticks * Trigger CI * apply fixes to base module
1 parent 6efc334 commit 63dda95

File tree

4 files changed

+122
-106
lines changed

4 files changed

+122
-106
lines changed

aeon/base/_base.py

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,20 @@ class BaseAeonEstimator(BaseEstimator, ABC):
5252
5353
Contains the following methods:
5454
55-
- reset estimator to post-init - reset(keep)
56-
- clone stimator (copy) - clone(random_state)
57-
- inspect tags (class method) - get_class_tags()
58-
- inspect tags (one tag, class) - get_class_tag(tag_name, tag_value_default,
59-
raise_error)
60-
- inspect tags (all) - get_tags()
61-
- inspect tags (one tag) - get_tag(tag_name, tag_value_default, raise_error)
62-
- setting dynamic tags - set_tags(**tag_dict)
63-
- get fitted parameters - get_fitted_params(deep)
55+
- reset estimator to post-init - ``reset(keep)``
56+
- clone stimator (copy) - ``clone(random_state)``
57+
- inspect tags (class method) - ``get_class_tags()``
58+
- inspect tags (one tag, class) - ``get_class_tag(tag_name, tag_value_default
59+
, raise_error)``
60+
- inspect tags (all) - ``get_tags()``
61+
- inspect tags (one tag) - ``get_tag(tag_name, tag_value_default
62+
, raise_error)``
63+
- setting dynamic tags - ``set_tags(**tag_dict)``
64+
- get fitted parameters - ``get_fitted_params(deep)``
6465
6566
All estimators have the attribute:
6667
67-
- fitted state flag - is_fitted
68+
- fitted state flag - ``is_fitted``
6869
"""
6970

7071
_tags = {
@@ -90,7 +91,7 @@ def reset(self, keep=None):
9091
"""
9192
Reset the object to a clean post-init state.
9293
93-
After a ``self.reset()`` call, self is equal or similar in value to
94+
After a ``self.reset()`` call, ``self`` is equal or similar in value to
9495
``type(self)(**self.get_params(deep=False))``, assuming no other attributes
9596
were kept using ``keep``.
9697
@@ -109,9 +110,9 @@ class and object methods, class attributes
109110
Parameters
110111
----------
111112
keep : None, str, or list of str, default=None
112-
If None, all attributes are removed except hyperparameters.
113-
If str, only the attribute with this name is kept.
114-
If list of str, only the attributes with these names are kept.
113+
If ``None``, all attributes are removed except hyperparameters.
114+
If ``str``, only the attribute with this name is kept.
115+
If ``list`` of ``str``, only the attributes with these names are kept.
115116
116117
Returns
117118
-------
@@ -156,15 +157,18 @@ def clone(self, random_state=None):
156157
Obtain a clone of the object with the same hyperparameters.
157158
158159
A clone is a different object without shared references, in post-init state.
159-
This function is equivalent to returning ``sklearn.clone`` of self.
160+
This function is equivalent to returning ``sklearn.clone`` of ``self``.
160161
Equal in value to ``type(self)(**self.get_params(deep=False))``.
161162
162163
Parameters
163164
----------
164165
random_state : int, RandomState instance, or None, default=None
165-
Sets the random state of the clone. If None, the random state is not set.
166-
If int, random_state is the seed used by the random number generator.
167-
If RandomState instance, random_state is the random number generator.
166+
Sets the random state of the clone. If ``None``, the random state is not
167+
set.
168+
If ``int``, ``random_state`` is the seed used by the random number
169+
generator.
170+
If ``RandomState`` instance, ``random_state`` is the random number
171+
generator.
168172
169173
Returns
170174
-------
@@ -218,21 +222,21 @@ def get_class_tag(
218222
tag_name : str
219223
Name of tag value.
220224
raise_error : bool, default=True
221-
Whether a ValueError is raised when the tag is not found.
225+
Whether a ``ValueError`` is raised when the tag is not found.
222226
tag_value_default : any type, default=None
223227
Default/fallback value if tag is not found and error is not raised.
224228
225229
Returns
226230
-------
227231
tag_value
228232
Value of the ``tag_name`` tag in cls.
229-
If not found, returns an error if ``raise_error`` is True, otherwise it
233+
If not found, returns an error if ``raise_error`` is ``True``, otherwise it
230234
returns ``tag_value_default``.
231235
232236
Raises
233237
------
234238
ValueError
235-
if ``raise_error`` is True and ``tag_name`` is not in
239+
if ``raise_error`` is ``True`` and ``tag_name`` is not in
236240
``self.get_tags().keys()``
237241
238242
Examples
@@ -278,15 +282,15 @@ def get_tag(self, tag_name, raise_error=True, tag_value_default=None):
278282
tag_name : str
279283
Name of tag to be retrieved.
280284
raise_error : bool, default=True
281-
Whether a ValueError is raised when the tag is not found.
285+
Whether a ``ValueError`` is raised when the tag is not found.
282286
tag_value_default : any type, default=None
283287
Default/fallback value if tag is not found and error is not raised.
284288
285289
Returns
286290
-------
287291
tag_value
288292
Value of the ``tag_name`` tag in self.
289-
If not found, returns an error if ``raise_error`` is True, otherwise it
293+
If not found, returns an error if ``raise_error`` is ``True``, otherwise it
290294
returns ``tag_value_default``.
291295
292296
Raises
@@ -323,7 +327,7 @@ def set_tags(self, **tag_dict):
323327
Returns
324328
-------
325329
self : object
326-
Reference to self.
330+
Reference to ``self``.
327331
"""
328332
tag_update = deepcopy(tag_dict)
329333
self._tags_dynamic.update(tag_update)
@@ -338,7 +342,7 @@ def get_fitted_params(self, deep=True):
338342
Parameters
339343
----------
340344
deep : bool, default=True
341-
If True, will return the fitted parameters for this estimator and
345+
If ``True``, will return the fitted parameters for this estimator and
342346
contained subobjects that are estimators.
343347
344348
Returns
@@ -385,7 +389,7 @@ def _check_is_fitted(self):
385389
if not self.is_fitted:
386390
raise NotFittedError(
387391
f"This instance of {self.__class__.__name__} has not "
388-
f"been fitted yet; please call `fit` first."
392+
f"been fitted yet; please call ``fit`` first."
389393
)
390394

391395
@classmethod
@@ -402,9 +406,10 @@ def _get_test_params(cls, parameter_set="default"):
402406
Returns
403407
-------
404408
params : dict or list of dict, default = {}
405-
Parameters to create testing instances of the class. Each dict are
409+
Parameters to create testing instances of the class. Each ``dict`` are
406410
parameters to construct an "interesting" test instance, i.e.,
407-
`MyClass(**params)` or `MyClass(**params[i])` creates a valid test instance.
411+
``MyClass(**params)`` or ``MyClass(**params[i])`` creates a valid test
412+
instance.
408413
"""
409414
# default parameters = empty dict
410415
return {}
@@ -414,23 +419,23 @@ def _create_test_instance(cls, parameter_set="default", return_first=True):
414419
"""
415420
Construct Estimator instance if possible.
416421
417-
Calls the `_get_test_params` method and returns an instance or list of instances
418-
using the returned dict or list of dict.
422+
Calls the ``_get_test_params`` method and returns an instance or ``list``
423+
of instances using the returned ``dict`` or list of ``dict``.
419424
420425
Parameters
421426
----------
422427
parameter_set : str, default="default"
423428
Name of the set of test parameters to return, for use in tests. If no
424429
special parameters are defined for a value, will return `"default"` set.
425430
return_first : bool, default=True
426-
If True, return the first instance of the list of instances.
427-
If False, return the list of instances.
431+
If ``True``, return the first instance of the list of instances.
432+
If ``False``, return the list of instances.
428433
429434
Returns
430435
-------
431436
instance : BaseAeonEstimator or list of BaseAeonEstimator
432-
Instance of the class with default parameters. If return_first
433-
is False, returns list of instances.
437+
Instance of the class with default parameters. If ``return_first``
438+
is ``False``, returns list of instances.
434439
"""
435440
params = cls._get_test_params(parameter_set=parameter_set)
436441

@@ -472,7 +477,7 @@ def _validate_data(self, **kwargs):
472477
def get_metadata_routing(self):
473478
"""Sklearn metadata routing.
474479
475-
Not supported by ``aeon`` estimators.
480+
Not supported by aeon estimators.
476481
"""
477482
raise NotImplementedError(
478483
"aeon estimators do not have a get_metadata_routing method."

aeon/base/_base_collection.py

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
class name: BaseCollectionEstimator
55
66
Defining methods:
7-
preprocessing - _preprocess_collection(self, X, store_metadata=True)
8-
input checking - _check_X(self, X)
9-
input conversion - _convert_X(self, X)
10-
shape checking - _check_shape(self, X)
7+
preprocessing - ``_preprocess_collection(self, X, store_metadata=True)``
8+
input checking - ``_check_X(self, X)``
9+
input conversion - ``_convert_X(self, X)``
10+
shape checking - ``_check_shape(self, X)``
1111
1212
Inherited inspection methods:
13-
hyper-parameter inspection - get_params()
14-
fitted parameter inspection - get_fitted_params()
13+
hyper-parameter inspection - ``get_params()``
14+
fitted parameter inspection - ``get_fitted_params()``
1515
1616
State:
1717
fitted model/strategy - by convention, any attributes ending in "_"
@@ -77,26 +77,26 @@ def _preprocess_collection(self, X, store_metadata=True):
7777
Parameters
7878
----------
7979
X : collection
80-
See aeon.utils.COLLECTIONS_DATA_TYPES for details on aeon supported
80+
See ``aeon.utils.COLLECTIONS_DATA_TYPES`` for details on aeon supported
8181
data structures.
8282
store_metadata : bool, default=True
83-
Whether to store metadata about X in self.metadata_.
83+
Whether to store metadata about ``X`` in ``self.metadata_``.
8484
8585
Returns
8686
-------
8787
X : collection
88-
Processed X. A data structure of type self.get_tag("X_inner_type").
88+
Processed ``X``. A data structure of type ``self.get_tag("X_inner_type")``.
8989
9090
Raises
9191
------
9292
ValueError
93-
If X is an invalid type or has characteristics that the estimator cannot
93+
If ``X`` is an invalid type or has characteristics that the estimator cannot
9494
handle.
9595
9696
See Also
9797
--------
9898
_check_X :
99-
Function that checks X is valid before conversion.
99+
Function that checks ``X`` is valid before conversion.
100100
_convert_X :
101101
Function that converts to inner type.
102102
@@ -126,37 +126,39 @@ def _check_X(self, X):
126126
Check if the input data is a compatible type, and that this estimator is
127127
able to handle the data characteristics.
128128
This is done by matching the capabilities of the estimator against the metadata
129-
for X i.e., univariate/multivariate, equal length/unequal length and no missing
130-
values/missing values.
129+
for ``X`` i.e., univariate/multivariate, equal length/unequal length
130+
and no missing values/missing values.
131131
132132
Parameters
133133
----------
134134
X : collection
135-
See aeon.utils.COLLECTIONS_DATA_TYPES for details on aeon supported
135+
See ``aeon.utils.COLLECTIONS_DATA_TYPES`` for details on aeon supported
136136
data structures.
137137
138138
Returns
139139
-------
140140
metadata : dict
141-
Metadata about X, with flags:
142-
metadata["multivariate"] : whether X has more than one channel or not
143-
metadata["missing_values"] : whether X has missing values or not
144-
metadata["unequal_length"] : whether X contains unequal length series.
145-
metadata["n_cases"] : number of cases in X
146-
metadata["n_channels"] : number of channels in X
147-
metadata["n_timepoints"] : number of timepoints in X if equal length, else
148-
None
141+
Metadata about ```X```, with flags:
142+
``metadata["multivariate"]`` : whether ``X`` has more than one channel or
143+
not
144+
``metadata["missing_values"]`` : whether ``X`` has missing values or not
145+
``metadata["unequal_length"]`` : whether ``X`` contains unequal length
146+
series.
147+
``metadata["n_cases"]`` : number of cases in ``X``
148+
``metadata["n_channels"]`` : number of channels in ``X``
149+
``metadata["n_timepoints"]`` : number of timepoints in ``X`` if equal
150+
length, else ``None``
149151
150152
Raises
151153
------
152154
ValueError
153-
If X is an invalid type or has characteristics that the estimator cannot
155+
If ``X`` is an invalid type or has characteristics that the estimator cannot
154156
handle.
155157
156158
See Also
157159
--------
158160
_convert_X :
159-
Function that converts X after it has been checked.
161+
Function that converts ``X`` after it has been checked.
160162
161163
Examples
162164
--------
@@ -197,30 +199,31 @@ def _check_X(self, X):
197199

198200
def _convert_X(self, X):
199201
"""
200-
Convert X to type defined by tag X_inner_type.
202+
Convert ``X`` to type defined by tag ``X_inner_type``.
201203
202204
If the input data is already an allowed type, it is returned unchanged.
203205
204-
If multiple types are allowed by self, then the best one for the type of input
205-
data is selected. So, for example, if X_inner_tag is ["np-list", "numpy3D"]
206-
and an df-list is passed, it will be converted to numpy3D if the series
207-
are equal length, and np-list if the series are unequal length.
206+
If multiple types are allowed by ``self``, then the best
207+
one for the type of input data is selected. So, for example, if
208+
``X_inner_tag`` is ["np-list", "numpy3D"] and an df-list is passed, it will
209+
be converted to ``numpy3D`` if the series are equal length, and np-list
210+
if the series are unequal length.
208211
209212
Parameters
210213
----------
211214
X : collection
212-
See aeon.utils.COLLECTIONS_DATA_TYPES for details on aeon supported
215+
See ``aeon.utils.COLLECTIONS_DATA_TYPES`` for details on aeon supported
213216
data structures.
214217
215218
Returns
216219
-------
217220
X : collection
218-
Converted X. A data structure of type self.get_tag("X_inner_type").
221+
Converted ``X``. A data structure of type ``self.get_tag("X_inner_type")``.
219222
220223
See Also
221224
--------
222225
_check_X :
223-
Function that checks X is valid and finds metadata.
226+
Function that checks ``X`` is valid and finds metadata.
224227
225228
Examples
226229
--------
@@ -263,17 +266,17 @@ def _convert_X(self, X):
263266

264267
def _check_shape(self, X):
265268
"""
266-
Check that the shape of X is consistent with the data seen in fit.
269+
Check that the shape of ``X`` is consistent with the data seen in fit.
267270
268271
Parameters
269272
----------
270273
X : data structure
271-
Must be of type aeon.registry.COLLECTIONS_DATA_TYPES.
274+
Must be of type ``aeon.registry.COLLECTIONS_DATA_TYPES``.
272275
273276
Raises
274277
------
275278
ValueError
276-
If the shape of X is not consistent with the data seen in fit.
279+
If the shape of ``X`` is not consistent with the data seen in fit.
277280
"""
278281
# if metadata is empty, then we have not seen any data in fit. If the estimator
279282
# has not been fitted, then _is_fitted should catch this.

0 commit comments

Comments
 (0)