Commit d8c2cd53 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Fix docs

parent 639cb0c6
Pipeline #61026 passed with stage
in 12 minutes and 12 seconds
...@@ -60,13 +60,11 @@ def get_bob_tags(estimator=None, force_tags=None): ...@@ -60,13 +60,11 @@ def get_bob_tags(estimator=None, force_tags=None):
Relies on the tags API of sklearn to set and retrieve the tags. Relies on the tags API of sklearn to set and retrieve the tags.
Specify an estimator tag values with ``estimator._more_tags``: Specify an estimator tag values with ``estimator._more_tags``::
``` class My_annotator_transformer(sklearn.base.BaseEstimator):
class My_annotator_transformer(sklearn.base.BaseEstimator): def _more_tags(self):
def _more_tags(self): return {"bob_output": "annotations"}
return {"bob_output": "annotations"}
```
The returned tags will take their value with the following priority: The returned tags will take their value with the following priority:
...@@ -74,69 +72,75 @@ def get_bob_tags(estimator=None, force_tags=None): ...@@ -74,69 +72,75 @@ def get_bob_tags(estimator=None, force_tags=None):
2. key:value in `estimator` tags (set with `estimator._more_tags()`) if it exists; 2. key:value in `estimator` tags (set with `estimator._more_tags()`) if it exists;
3. the default value for that tag if none of the previous exist. 3. the default value for that tag if none of the previous exist.
Tags format Examples
----------- --------
bob_input: str bob_input: str
The Sample attribute passed to the first argument of the fit or transform method. The Sample attribute passed to the first argument of the fit or transform method.
Example: Default value is ``data``.
`{"bob_input": ("annotations")}` Example::
will result in:
`estimator.transform(sample.annotations)` {"bob_input": ("annotations")}
Default:
`{"bob_input": "data"}` will result in::
estimator.transform(sample.annotations)
bob_transform_extra_input: tuple of str bob_transform_extra_input: tuple of str
Each element of the tuple is a str representing an attribute of a Sample Each element of the tuple is a str representing an attribute of a Sample
object. Each attribute of the sample will be passed as argument to the transform object. Each attribute of the sample will be passed as argument to the transform
method in that order. method in that order. Default value is an empty tuple ``(,)``.
Example: Example::
`{"bob_transform_extra_input": (("arg_0","data"), ("arg_1","annotations"))}`
will result in: {"bob_transform_extra_input": (("arg_0","data"), ("arg_1","annotations"))}
`estimator.transform(sample.data, arg_0=sample.data, arg_1=sample.annotations)`
Default: will result in::
`{"bob_transform_extra_input": tuple()}`
estimator.transform(sample.data, arg_0=sample.data, arg_1=sample.annotations)
bob_fit_extra_input: tuple of str bob_fit_extra_input: tuple of str
Each element of the tuple is a str representing an attribute of a Sample Each element of the tuple is a str representing an attribute of a Sample
object. Each attribute of the sample will be passed as argument to the fit object. Each attribute of the sample will be passed as argument to the fit
method in that order. method in that order. Default value is an empty tuple ``(,)``.
Example: Example::
`{"bob_fit_extra_input": (("y", "annotations"), ("extra "metadata"))}`
will result in: {"bob_fit_extra_input": (("y", "annotations"), ("extra "metadata"))}
`estimator.fit(sample.data, y=sample.annotations, extra=sample.metadata)`
Default: will result in::
`{"bob_fit_extra_input": tuple()}`
estimator.fit(sample.data, y=sample.annotations, extra=sample.metadata)
bob_output: str bob_output: str
The Sample attribute in which the output of the transform is stored. The Sample attribute in which the output of the transform is stored.
Default: Default value is ``data``.
`{"bob_output": "data"}`
bob_checkpoint_extension: str bob_checkpoint_extension: str
The extension of each checkpoint file. The extension of each checkpoint file.
Default: Default value is ``.h5``.
`{"bob_checkpoint_extension": ".h5"}`
bob_features_save_fn: func bob_features_save_fn: func
The function used to save each checkpoint file. The function used to save each checkpoint file.
Default: Default value is :any:`bob.io.base.save`.
`{"bob_features_save_fn": bob.io.base.save}`
bob_features_load_fn: func bob_features_load_fn: func
The function used to load each checkpoint file. The function used to load each checkpoint file.
Default: Default value is :any:`bob.io.base.load`.
`{"bob_features_load_fn": bob.io.base.load}`
bob_fit_supports_dask_array: bool bob_fit_supports_dask_array: bool
Indicates that the fit method of that estimator accepts dask arrays as Indicates that the fit method of that estimator accepts dask arrays as
input. You may only use this tag if you accept X (N, M) and optionally y input. You may only use this tag if you accept X (N, M) and optionally y
(N) as input. The fit function may not accept any other input. (N) as input. The fit function may not accept any other input.
Default: Default value is ``False``.
`{"bob_fit_supports_dask_array": False}`
bob_fit_supports_dask_bag: bool bob_fit_supports_dask_bag: bool
Indicates that the fit method of that estimator accepts dask bags as Indicates that the fit method of that estimator accepts dask bags as
input. If true, each input parameter of the fit will be a dask bag. You input. If true, each input parameter of the fit will be a dask bag. You
still can (and normally you should) wrap your estimator with the still can (and normally you should) wrap your estimator with the
SampleWrapper so the same code runs with and without dask. SampleWrapper so the same code runs with and without dask.
Default: Default value is ``False``.
`{"bob_fit_supports_dask_bag": False}`
bob_checkpoint_features: bool bob_checkpoint_features: bool
If False, the features of the estimator will never be saved. If False, the features of the estimator will never be saved.
Default: Default value is ``True``.
`{"bob_checkpoint_features": True}`
Parameters Parameters
---------- ----------
......
...@@ -11,3 +11,4 @@ py:class PeriodicCallback ...@@ -11,3 +11,4 @@ py:class PeriodicCallback
py:class defaultdict py:class defaultdict
py:class WorkerState py:class WorkerState
py:class deque py:class deque
py:class sklearn.BaseEstimator
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment