neuraxle.steps.loop¶
Module-level documentation for neuraxle.steps.loop. Here is an inheritance diagram, including dependencies to other base modules of Neuraxle:
Pipeline Steps For Looping¶
Classes
|
|
|
|
|
|
|
|
|
Step that reduces a dimension instead of manually looping on it. |
|
Truncable step that fits/transforms each step for each of the data inputs, and expected outputs. |
|
Examples using neuraxle.steps.loop.FlattenForEach
¶
Examples using neuraxle.steps.loop.ForEach
¶
Exceptions
This exception is used to signal the interruption of a minibatch |
|
This exception is used to signal to the minibatch iterator to skip the rest of the execution of the current iteration. |
-
class
neuraxle.steps.loop.
ForEach
(wrapped: neuraxle.base.BaseTransformer, cache_folder_when_no_handle=None)[source]¶ Bases:
neuraxle.base.ForceHandleOnlyMixin
,neuraxle.base.MetaStep
Truncable step that fits/transforms each step for each of the data inputs, and expected outputs.
See also
BaseStep
,BaseSaver
,BaseHasher
,NonTransformableMixin
,Pipeline
,HyperparameterSamples
,HyperparameterSpace
,DataContainer
-
__init__
(wrapped: neuraxle.base.BaseTransformer, cache_folder_when_no_handle=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
_fit_data_container
(data_container: neuraxle.data_container.DataContainer, context: neuraxle.base.ExecutionContext) → neuraxle.base.BaseStep[source]¶ Fit each step for each data inputs, and expected outputs
- Return type
- Parameters
data_container (DataContainer) – data container
context (ExecutionContext) – execution context
- Returns
self
-
_transform_data_container
(data_container: neuraxle.data_container.DataContainer, context: neuraxle.base.ExecutionContext) → neuraxle.data_container.DataContainer[source]¶ Transform each step for each data inputs.
- Return type
- Parameters
data_container (DataContainer) – data container
context (ExecutionContext) – execution context
- Returns
self
-
_fit_transform_data_container
(data_container: neuraxle.data_container.DataContainer, context: neuraxle.base.ExecutionContext) → Tuple[neuraxle.base.BaseStep, neuraxle.data_container.DataContainer][source]¶ Fit transform each step for each data inputs, and expected outputs
- Parameters
data_container (DataContainer) – data container to fit transform
context (ExecutionContext) – execution context
- Returns
self, transformed_data_container
-
_abc_impl
= <_abc_data object>¶
-
-
exception
neuraxle.steps.loop.
ContinueInterrupt
[source]¶ Bases:
Exception
This exception is used to signal to the minibatch iterator to skip the rest of the execution of the current iteration.
-
exception
neuraxle.steps.loop.
BreakInterrupt
[source]¶ Bases:
Exception
This exception is used to signal the interruption of a minibatch
-
class
neuraxle.steps.loop.
Break
[source]¶ Bases:
neuraxle.base.ForceHandleMixin
,neuraxle.base.Identity
-
_did_process
(data_container: neuraxle.data_container.DataContainer, context: neuraxle.base.ExecutionContext) → neuraxle.data_container.DataContainer[source]¶ Apply side effects after any step method.
- Return type
- Parameters
data_container (
DataContainer
) – data containercontext (
ExecutionContext
) – execution context
- Returns
(data container, execution context)
-
_abc_impl
= <_abc_data object>¶
-
-
class
neuraxle.steps.loop.
BreakIf
(condition_function: Callable)[source]¶ Bases:
neuraxle.steps.flow.ExecuteIf
-
__init__
(condition_function: Callable)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
_abc_impl
= <_abc_data object>¶
-
-
class
neuraxle.steps.loop.
Continue
[source]¶ Bases:
neuraxle.base.ForceHandleMixin
,neuraxle.base.Identity
-
_did_process
(data_container: neuraxle.data_container.DataContainer, context: neuraxle.base.ExecutionContext) → neuraxle.data_container.DataContainer[source]¶ Apply side effects after any step method.
- Return type
- Parameters
data_container (
DataContainer
) – data containercontext (
ExecutionContext
) – execution context
- Returns
(data container, execution context)
-
_abc_impl
= <_abc_data object>¶
-
-
class
neuraxle.steps.loop.
ContinueIf
(condition_function: Callable)[source]¶ Bases:
neuraxle.steps.flow.ExecuteIf
-
__init__
(condition_function: Callable)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
_abc_impl
= <_abc_data object>¶
-
-
class
neuraxle.steps.loop.
StepClonerForEachDataInput
(wrapped: neuraxle.base.BaseTransformer, copy_op=<function deepcopy>)[source]¶ Bases:
neuraxle.base.ForceHandleOnlyMixin
,neuraxle.base.MetaStep
-
__init__
(wrapped: neuraxle.base.BaseTransformer, copy_op=<function deepcopy>)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
get_children
() → List[neuraxle.base.BaseStep][source]¶ Get the list of all the children for that step.
- Returns
list of children. The first is the original wrapped step, the others are the steps that are cloned.
-
_will_process
(data_container: neuraxle.data_container.DataContainer, context: neuraxle.base.ExecutionContext) → Tuple[neuraxle.base.BaseStep, neuraxle.data_container.DataContainer][source]¶ Apply side effects before any step method. :type context:
ExecutionContext
:type data_container:DataContainer
:param data_container: data container :param context: execution context :return: (data container, execution context)
-
_fit_transform_data_container
(data_container: neuraxle.data_container.DataContainer, context: neuraxle.base.ExecutionContext) → Tuple[neuraxle.base.BaseStep, neuraxle.data_container.DataContainer][source]¶ Fit and transform data container with the given execution context. Will do:
data_container, context = self._fit_data_container(data_container, context) data_container = self._transform_data_container(data_container, context) return self, data_container
- Parameters
data_container (
DataContainer
) – data containercontext (
ExecutionContext
) – execution context
- Returns
transformed data container
-
_fit_data_container
(data_container: neuraxle.data_container.DataContainer, context: neuraxle.base.ExecutionContext) → Tuple[neuraxle.base.BaseStep, neuraxle.data_container.DataContainer][source]¶ Fit data container.
- Parameters
data_container (
DataContainer
) – data containercontext (
ExecutionContext
) – execution context
- Returns
(fitted self, data container)
-
_transform_data_container
(data_container: neuraxle.data_container.DataContainer, context: neuraxle.base.ExecutionContext) → Tuple[neuraxle.base.BaseStep, neuraxle.data_container.DataContainer][source]¶ Transform data container.
- Parameters
data_container (
DataContainer
) – data containercontext (
ExecutionContext
) – execution context
- Returns
data container
-
_inverse_transform_data_container
(data_container: neuraxle.data_container.DataContainer, context: neuraxle.base.ExecutionContext) → neuraxle.data_container.DataContainer[source]¶
-
inverse_transform
(processed_outputs)[source]¶ Inverse Transform the given transformed data inputs.
p = Pipeline([MultiplyByN(2)]) _in = np.array([1, 2]) _out = p.transform(_in) _regenerated_in = p.inverse_transform(_out) assert np.array_equal(_regenerated_in, _in) assert np.array_equal(_out, _in * 2)
- Parameters
processed_outputs – processed data inputs
- Returns
inverse transformed processed outputs
-
_abc_impl
= <_abc_data object>¶
-
-
class
neuraxle.steps.loop.
FlattenForEach
(wrapped: neuraxle.base.BaseTransformer, then_unflatten: bool = True)[source]¶ Bases:
neuraxle.base.ForceHandleMixin
,neuraxle.base.MetaStep
Step that reduces a dimension instead of manually looping on it.
See also
BaseStep
,BaseSaver
,BaseHasher
,MetaStepMixin
,NonTransformableMixin
,Pipeline
,HyperparameterSamples
,HyperparameterSpace
,DataContainer
-
__init__
(wrapped: neuraxle.base.BaseTransformer, then_unflatten: bool = True)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
_will_process
(data_container: neuraxle.data_container.DataContainer, context: neuraxle.base.ExecutionContext) → Tuple[neuraxle.base.BaseStep, neuraxle.data_container.DataContainer][source]¶ Flatten data container before any processing is done on the wrapped step.
- Parameters
data_container (
DataContainer
) – data container to flattencontext (
ExecutionContext
) – execution context
- Returns
(data container, execution context)
-
_flatten_list
(list_to_flatten)[source]¶ Flatten the first dimension of a list.
- Parameters
list_to_flatten – list to flatten
- Returns
flattened list, len flattened lists
-
_did_process
(data_container: neuraxle.data_container.DataContainer, context: neuraxle.base.ExecutionContext) → neuraxle.data_container.DataContainer[source]¶ Reaugment the flattened data container.
- Return type
- Parameters
data_container (
DataContainer
) – data container to then_unflattencontext (
ExecutionContext
) – execution context
- Returns
data container
-
_reaugment_list
(list_to_reaugment, flattened_dimension_lengths)[source]¶ Reaugment list with the flattened dimension lengths.
- Parameters
list_to_reaugment – list to then_unflatten
- Returns
reaugmented numpy array
-
_abc_impl
= <_abc_data object>¶
-