Skip to content

Commit

Permalink
Merge pull request #452 from vincent-antaki/documentation-update
Browse files Browse the repository at this point in the history
Documentation update
  • Loading branch information
vincent-antaki authored Feb 24, 2021
2 parents 9f229c3 + a2f3a46 commit e429194
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 46 deletions.
48 changes: 24 additions & 24 deletions examples/Handler Methods.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,26 @@
"\n",
"### [handle_fit_transform](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep.handle_fit)\n",
"\n",
"1. [_will_process(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._will_process): Apply side effects before any step method.\n",
"2. [_will_fit_transform(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._will_fit_transform): Apply side effects before fit_transform\n",
"3. [_fit_transform_data_container(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._fit_transform_data_container): Fit transform data container.\n",
"4. [_did_fit_transform(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._did_fit_transform): Apply side effects after fit_transform.\n",
"5. [_did_process(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._did_process): Apply side effects after any step method.\n",
"1. [\\_will\\_process(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._will_process): Apply side effects before any step method.\n",
"2. [\\_will\\_fit_transform(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._will_fit_transform): Apply side effects before fit_transform\n",
"3. [\\_fit\\_transform\\_data\\_container(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._fit_transform_data_container): Fit transform data container.\n",
"4. [\\_did\\_fit\\_transform(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._did_fit_transform): Apply side effects after fit_transform.\n",
"5. [\\_did\\_process(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._did_process): Apply side effects after any step method.\n",
"\n",
"### [handle_fit](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep.handle_fit)\n",
"\n",
"1. [_will_process(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._will_process): Apply side effects before any step method.\n",
"2. [_will_fit(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._will_fit): Apply side effects before fit.\n",
"3. [_fit_data_container(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._fit_data_container): Fit data container.\n",
"4. [_did_fit(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._did_fit): Apply side effects after fit.\n",
"1. [\\_will\\_process(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._will_process): Apply side effects before any step method.\n",
"2. [\\_will\\_fit(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._will_fit): Apply side effects before fit.\n",
"3. [\\_fit\\_data\\_container(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._fit_data_container): Fit data container.\n",
"4. [\\_did\\_fit(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._did_fit): Apply side effects after fit.\n",
"\n",
"### [handle_transform](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep.handle_transform)\n",
"\n",
"1. [_will_process(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._will_process): Apply side effects before any step method\n",
"2. [_will_transform(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._will_transform_data_container): Apply side effects before transform.\n",
"3. [_transform_data_container(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._transform_data_container): Fit transform data container.\n",
"4. [_did_transform(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._did_transform): Apply side effects after transform. \n",
"5. [_did_process(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._did_process): Apply side effects after any step method.\n",
"1. [\\_will\\_process(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._will_process): Apply side effects before any step method\n",
"2. [\\_will\\_transform(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._will_transform_data_container): Apply side effects before transform.\n",
"3. [\\_transform\\_data_container(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._transform_data_container): Fit transform data container.\n",
"4. [\\_did\\_transform(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._did_transform): Apply side effects after transform. \n",
"5. [\\_did\\_process(data_container, context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._did_process): Apply side effects after any step method.\n",
"\n",
"### When to use handler methods ? \n",
"\n",
Expand Down Expand Up @@ -169,9 +169,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"2. Implement [_transform_data_container](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._transform_data_container): \n",
"2. Implement [\\_transform\\_data\\_container](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._transform_data_container): \n",
"\n",
"Pass expected outputs to the wrapped step [handle_transform](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base.BaseStep.handle_transform) method. Update the data container expected outputs with the outputs."
"Pass expected outputs to the wrapped step [handle_transform](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep.handle_transform) method. Update the data container expected outputs with the outputs."
]
},
{
Expand All @@ -198,7 +198,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"2. Implement [_fit_data_container](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._fit_data_container): \n",
"2. Implement [\\_fit\\_data\\_container](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._fit_data_container): \n",
"\n",
"Pass expected outputs to the wrapped step [handle_fit](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep.handle_fit) method. Update the data container expected outputs with the outputs."
]
Expand All @@ -225,7 +225,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"3. Implement [_fit_transform_data_container](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._fit_transform_data_container): \n",
"3. Implement [\\_fit\\_transform\\_data\\_container](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._fit_transform_data_container): \n",
"\n",
"Pass expected outputs to the wrapped step [handle_fit_transform](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep.handle_fit_transform) method.\n",
"Update the data container expected outputs with the outputs."
Expand Down Expand Up @@ -379,7 +379,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"2. Implement the [_will_process](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._will_process) lifecycle method to expand the data inside the data container."
"2. Implement the [\\_will\\_process](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._will_process) lifecycle method to expand the data inside the data container."
]
},
{
Expand All @@ -397,7 +397,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"3. Implement the [_did_process](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._did_process) lifecycle method to reduce the dimension of the data inside the data container."
"3. Implement the [\\_did\\_process](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._did_process) lifecycle method to reduce the dimension of the data inside the data container."
]
},
{
Expand Down Expand Up @@ -514,7 +514,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"1. Create a step that inherits from [HandleOnlyMixin](https://www.neuraxle.org/stable/api/neuraxle.base.html?highlight=handleonlymixin#neuraxle.base.HandleOnlyMixin), and [TruncableSteps](). Initialize TruncableSteps with a preprocessing, and a postprocessing step."
"1. Create a step that inherits from [HandleOnlyMixin](https://www.neuraxle.org/stable/api/neuraxle.base.html?highlight=handleonlymixin#neuraxle.base.HandleOnlyMixin), and [TruncableSteps](https://www.neuraxle.org/stable/api/neuraxle.base.html?highlight=truncable%20step#neuraxle.base.TruncableSteps). Initialize TruncableSteps with a preprocessing, and a postprocessing step."
]
},
{
Expand All @@ -536,7 +536,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"2. Implement [_fit_data_container](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._fit_data_container): "
"2. Implement [\\_fit\\_data\\_container](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._fit_data_container): "
]
},
{
Expand All @@ -558,7 +558,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"3. Implement [_transform_data_container](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._transform_data_container): "
"3. Implement [\\_transform\\_data\\_container](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep._transform_data_container): "
]
},
{
Expand Down Expand Up @@ -590,7 +590,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"4. Implement [_fit_transform_data_container](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._fit_transform_data_container): "
"4. Implement [\\_fit\\_transform\\_data\\_container](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep._fit_transform_data_container): "
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions examples/Step Saving And Lifecycle.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"1. [BaseStep.__init__(hyperparams, hyperparams_space, name)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base.BaseStep): This is where you initialize all of your props, and fitted state. \n",
"1. [BaseStep.\\_\\_init\\_\\_(hyperparams, hyperparams_space, name)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base.BaseStep): This is where you initialize all of your props, and fitted state. \n",
"2. [set_hyperparams(hyperperparams)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._HasHyperparams.set_hyperparams): Configure your steps' hyperparameters before initializing it.\n",
"3. [setup(context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base.TransformerStep.setup): Initialize the step before it runs. Only from here and not before that heavy things should be created (e.g.: things inside GPU), and NOT in the constructor.\n",
"3. [setup(context)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base.BaseTransformer.setup): Initialize the step before it runs. Only from here and not before that heavy things should be created (e.g.: things inside GPU), and NOT in the constructor.\n",
"4. [fit(data_inputs, expected_outputs)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._FittableStep.fit): Fit step with the given data inputs, and expected outputs.\n",
"\n",
"5. [transform(data_inputs)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._TransformerStep.transform): Transform given data inputs.\n",
"6. [save(context, full_dump)](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base._HasSavers.save): Save step using the execution context to create the directory to save the step into.\n",
"7. [teardown()](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base.TransformerStep.teardown): Teardown step after program execution. Inverse of setup, and it should clear memory. Override this method if you need to clear memory."
"7. [teardown()](https://www.neuraxle.org/stable/api/neuraxle.base.html#neuraxle.base.BaseTransformer.teardown): Teardown step after program execution. Inverse of setup, and it should clear memory. Override this method if you need to clear memory."
]
},
{
Expand Down
15 changes: 9 additions & 6 deletions neuraxle/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,7 @@ def set_hyperparams(self, hyperparams: HyperparameterSamples) -> 'BaseTransforme
:return: self
.. note::
This is a recursive method that will call :func:`~neuraxle.base._HasHyperparams._set_hyperparams` in the end.
This is a recursive method that will call :func:`~neuraxle.base._HasHyperparams._set_hyperparams`.
.. seealso::
:class:`~neuraxle.hyperparams.space.HyperparameterSamples`,
:class:̀_HasChildrenMixin`,
Expand Down Expand Up @@ -1488,9 +1488,9 @@ def get_hyperparams(self) -> HyperparameterSamples:
:return: step hyperparameters
.. note::
This is a recursive method that will call :func:`~neuraxle.base._HasHyperparams._get_hyperparams` in the end.
This is a recursive method that will call :func:`~neuraxle.base._HasHyperparams._get_hyperparams`.
.. seealso::
* :class:`~neuraxle.hyperparams.space.HyperparameterSamples`
:class:`~neuraxle.hyperparams.space.HyperparameterSamples`,
:class:̀_HasChildrenMixin`,
:func:`BaseStep.apply`,
:func:`_HasChildrenMixin._apply`,
Expand All @@ -1514,7 +1514,7 @@ def set_params(self, **params) -> 'BaseTransformer':
hyperparams = s.get_params()
assert hyperparams == {"learning_rate": 0.1}
:param **params: arbitrary number of arguments for hyperparameters
:param arbitrary number of arguments for hyperparameters
.. note::
This is a recursive method that will call :func:`~neuraxle.base._HasHyperparams._set_params` in the end.
Expand Down Expand Up @@ -2121,8 +2121,10 @@ def invalidate(self) -> 'BaseTransformer':
* the step name has changed func:`~neuraxle.base.BaseStep.set_name`
:return: self
.. note::
This is a recursive method used in :class:̀_HasChildrenMixin`.
.. seealso::
:func:`~neuraxle.base._HasRecursiveMethods.apply`,
:func:`~neuraxle.base._HasChildrenMixin._apply`
Expand Down Expand Up @@ -2195,6 +2197,7 @@ def reverse(self) -> 'BaseTransformer':
Note: the reverse may fail if there is a pending mutate that was set earlier with ``.will_mutate_to``.
:return: a copy of self, reversed. Each contained object will also have been reversed if self is a pipeline.
.. seealso::
:func:`~neuraxle.base._TransformerStep.inverse_transform`
"""
Expand Down Expand Up @@ -3003,9 +3006,9 @@ def _refresh_steps(self):
def should_save(self):
"""
Returns if the step needs to be saved or not.
If self should be saved or any of his sub steps, return True.
:return:
:return: If self or any of his sub steps should be saved, returns True.
.. seealso::
:class:`TruncableJoblibStepSaver`
"""
Expand Down
25 changes: 14 additions & 11 deletions neuraxle/data_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@


class AbsentValuesNullObject:
"""This object, when passed to the default_value_data_inputs argument of the DataContainer.batch method, will return the minibatched data containers such that the last batch won't have the full batch_size if it was incomplete with trailing None values at the end."""
"""
This object, when passed to the default_value_data_inputs argument of the DataContainer.batch method, will return the minibatched data containers such that the last batch won't have the full batch_size if it was incomplete with trailing None values at the end.
"""
pass


Expand All @@ -53,7 +55,7 @@ class DataContainer:
.. seealso::
:class:`~neuraxle.base.BaseHasher`,
:class: `neuraxle.base.BaseStep`
:class:`~neuraxle.base.BaseStep`,
:class:`~neuraxle.data_container.DataContainer.AbsentValuesNullObject`
"""

Expand Down Expand Up @@ -92,7 +94,7 @@ def set_data_inputs(self, data_inputs: Iterable):
:param data_inputs: data inputs
:type data_inputs: Iterable
:return:
:return: self
"""
self.data_inputs = data_inputs
return self
Expand All @@ -103,7 +105,7 @@ def set_expected_outputs(self, expected_outputs: Iterable):
:param expected_outputs: expected outputs
:type expected_outputs: Iterable
:return:
:return: self
"""
self.expected_outputs = expected_outputs
return self
Expand All @@ -114,7 +116,7 @@ def set_current_ids(self, current_ids: List[str]):
:param current_ids: data inputs
:type current_ids: List[str]
:return:
:return: self
"""
self.current_ids = current_ids
return self
Expand All @@ -124,17 +126,18 @@ def set_summary_id(self, summary_id: str):
Set summary id.
:param summary_id: str
:return:
:return: self
"""
self.summary_id = summary_id
return self

def set_sub_data_containers(self, sub_data_containers: List['DataContainer']):
"""
Set sub data containers
:return:
:return: self
"""
self.sub_data_containers = sub_data_containers
return self

def hash_summary(self):
"""
Expand Down Expand Up @@ -206,8 +209,8 @@ def minibatches(
:return: an iterator of DataContainer
:rtype: Iterable[DataContainer]
..seealso
:class:`~neuraxle.data_container.DataContainer.AbsentValuesNullObject`,
.. seealso::
:class:`~neuraxle.data_container.DataContainer.AbsentValuesNullObject`
"""
for i in range(0, len(self.data_inputs), batch_size):
data_container = DataContainer(
Expand Down Expand Up @@ -369,7 +372,7 @@ class ExpandedDataContainer(DataContainer):
Sub class of DataContainer to expand data container dimension.
.. seealso::
:class:`DataContainer`,
:class:`DataContainer`
"""

def __init__(self, data_inputs, current_ids, expected_outputs, summary_id, old_current_ids):
Expand Down Expand Up @@ -426,7 +429,7 @@ class ZipDataContainer(DataContainer):
Sub class of DataContainer to zip two data sources together.
.. seealso::
:class:`DataContainer`,
:class: `DataContainer`
"""

@staticmethod
Expand Down
Loading

0 comments on commit e429194

Please sign in to comment.