neuraxle.steps.loop

Pipeline Steps For Looping

Classes

ForEachDataInput(wrapped)

Truncable step that fits/transforms each step for each of the data inputs, and expected outputs.

StepClonerForEachDataInput(wrapped[, copy_op])

class neuraxle.steps.loop.ForEachDataInput(wrapped: neuraxle.base.BaseStep)[source]

Truncable step that fits/transforms each step for each of the data inputs, and expected outputs.

fit(data_inputs, expected_outputs=None)[source]

Fit step with the given data inputs, and expected outputs.

Parameters
  • data_inputs – data inputs

  • expected_outputs – expected outputs to fit on

Returns

fitted self

Return type

BaseStep

fit_transform(data_inputs, expected_outputs=None)[source]

Fit transform each step for each data inputs, and expected outputs

Parameters
  • data_inputs (Iterable) – data inputs to fit transform

  • expected_outputs (Iterable) – expected outputs to fit transform on

Returns

self, transformed_data_container

hash_data_container(data_container)[source]

Hash data container using self.hashers.

  1. Hash current ids with hyperparams.

  2. Hash summary id with hyperparams.

Parameters

data_container (DataContainer) – the data container to transform

Returns

transformed data container

Return type

DataContainer

should_resume(data_container: neuraxle.data_container.DataContainer, context: neuraxle.base.ExecutionContext)[source]

Returns True if a step can be resumed with the given the data container, and execution context. See Checkpoint class documentation for more details on how a resumable checkpoint works.

Parameters
  • data_container – data container to resume from

  • context – execution context to resume from

Returns

if we can resume

Return type

bool

transform(data_inputs)[source]

Transform each step for each data inputs.

Parameters

data_inputs (Iterable) – data inputs to transform

Returns

outputs

class neuraxle.steps.loop.StepClonerForEachDataInput(wrapped: neuraxle.base.BaseStep, copy_op=<function deepcopy>)[source]
fit(data_inputs: List, expected_outputs: List = None) → neuraxle.steps.loop.StepClonerForEachDataInput[source]

Fit step with the given data inputs, and expected outputs.

Parameters
  • data_inputs – data inputs

  • expected_outputs – expected outputs to fit on

Returns

fitted self

Return type

BaseStep

fit_transform(data_inputs, expected_outputs=None) -> ('BaseStep', typing.Any)[source]

Fit, and transform step with the given data inputs, and expected outputs.

Parameters
  • data_inputs – data inputs

  • expected_outputs – expected outputs to fit on

Returns

(fitted self, tranformed data inputs)

Return type

Tuple[BaseStep, Any]

inverse_transform(data_output)[source]

Inverse Transform the given transformed data inputs.

mutate() or reverse() can be called to change the default transform behavior :

p = Pipeline([MultiplyBy()])

_in = np.array([1, 2])

_out = p.transform(_in)

_regenerated_in = reversed(p).transform(_out)

assert np.array_equal(_regenerated_in, _in)
Parameters

processed_outputs – processed data inputs

Returns

inverse transformed processed outputs

Return type

Any

set_hyperparams(hyperparams: neuraxle.hyperparams.space.HyperparameterSamples) → neuraxle.base.BaseStep[source]

Set step hyperparameters, and wrapped step hyperparams with the given hyperparams.

Example :

step.set_hyperparams(HyperparameterSamples({
    'learning_rate': 0.10
    'wrapped__learning_rate': 0.10 # this will set the wrapped step 'learning_rate' hyperparam
}))
Parameters

hyperparams (HyperparameterSamples) – hyperparameters

Returns

self

Return type

BaseStep

See also

HyperparameterSamples

set_hyperparams_space(hyperparams_space: neuraxle.hyperparams.space.HyperparameterSpace) → neuraxle.base.BaseStep[source]

Set meta step and wrapped step hyperparams space using the given hyperparams space.

Parameters

hyperparams_space (HyperparameterSpace) – ordered dict containing all hyperparameter spaces

Returns

self

transform(data_inputs: List) → List[source]

Transform given data inputs.

Parameters

data_inputs – data inputs

Returns

transformed data inputs

Return type

Any

update_hyperparams(hyperparams: neuraxle.hyperparams.space.HyperparameterSamples) → neuraxle.base.BaseStep[source]

Update the step hyperparameters without removing the already-set hyperparameters. Please refer to update_hyperparams().

Parameters

hyperparams (HyperparameterSamples) – hyperparams to update

Returns

self

Return type

BaseStep

See also

update_hyperparams(), HyperparameterSamples