@@ -3035,6 +3035,13 @@ class TransformHandlerOnlyMixin(NonFittableMixin):
3035
3035
3036
3036
@abstractmethod
3037
3037
def _transform_data_container (self , data_container : DataContainer , context : ExecutionContext ) -> DataContainer :
3038
+ """
3039
+ Transform data container with the given execution context.
3040
+
3041
+ :param data_container: data container
3042
+ :param context: execution context
3043
+ :return: transformed data container
3044
+ """
3038
3045
raise NotImplementedError ('Must implement _transform_data_container in {0}' .format (self .name ))
3039
3046
3040
3047
def transform (self , data_inputs ) -> 'HandleOnlyMixin' :
@@ -3111,7 +3118,13 @@ def __init__(self, cache_folder=None):
3111
3118
cache_folder = DEFAULT_CACHE_FOLDER
3112
3119
self .cache_folder = cache_folder
3113
3120
3114
- def transform (self , data_inputs ):
3121
+ def transform (self , data_inputs ) -> Iterable :
3122
+ """
3123
+ Using :func:`~neuraxle.base.BaseStep.handle_transform`, transform data inputs.
3124
+
3125
+ :param data_inputs: data inputs
3126
+ :return: outputs
3127
+ """
3115
3128
execution_context = ExecutionContext (self .cache_folder , execution_mode = ExecutionMode .TRANSFORM )
3116
3129
context , data_container = self ._encapsulate_data (
3117
3130
data_inputs , expected_outputs = None , execution_mode = ExecutionMode .TRANSFORM )
@@ -3121,18 +3134,38 @@ def transform(self, data_inputs):
3121
3134
return data_container .data_inputs
3122
3135
3123
3136
def fit (self , data_inputs , expected_outputs = None ) -> 'HandleOnlyMixin' :
3137
+ """
3138
+ Using :func:`~neuraxle.base.BaseStep.handle_fit`, fit step with the given data inputs, and expected outputs.
3139
+
3140
+ :param data_inputs: data inputs
3141
+ :return: fitted self
3142
+ """
3124
3143
context , data_container = self ._encapsulate_data (data_inputs , expected_outputs , ExecutionMode .FIT )
3125
3144
new_self = self .handle_fit (data_container , context )
3126
3145
3127
3146
return new_self
3128
3147
3129
3148
def fit_transform (self , data_inputs , expected_outputs = None ) -> Tuple ['HandleOnlyMixin' , Iterable ]:
3149
+ """
3150
+ Using :func:`~neuraxle.base.BaseStep.handle_fit_transform`, fit and transform step with the given data inputs, and expected outputs.
3151
+
3152
+ :param data_inputs: data inputs
3153
+ :return: fitted self, outputs
3154
+ """
3130
3155
context , data_container = self ._encapsulate_data (data_inputs , expected_outputs , ExecutionMode .FIT_TRANSFORM )
3131
3156
new_self , data_container = self .handle_fit_transform (data_container , context )
3132
3157
3133
3158
return new_self , data_container .data_inputs
3134
3159
3135
- def _encapsulate_data (self , data_inputs , expected_outputs = None , execution_mode = None ):
3160
+ def _encapsulate_data (self , data_inputs , expected_outputs = None , execution_mode = None ) -> Tuple [ExecutionContext , DataContainer ]:
3161
+ """
3162
+ Encapsulate data with :class:`~neuraxle.data_container.DataContainer`.
3163
+
3164
+ :param data_inputs: data inputs
3165
+ :param expected_outputs: expected outputs
3166
+ :param execution_mode: execution mode
3167
+ :return: execution context, data container
3168
+ """
3136
3169
data_container = DataContainer (data_inputs = data_inputs , expected_outputs = expected_outputs )
3137
3170
context = ExecutionContext (root = self .cache_folder , execution_mode = execution_mode )
3138
3171
@@ -3179,6 +3212,16 @@ class FullDumpLoader(Identity):
3179
3212
Identity step that can load the full dump of a pipeline step.
3180
3213
Used by :func:`~neuraxle.base.BaseStep.load`.
3181
3214
3215
+ Usage example:
3216
+
3217
+ .. code-block:: python
3218
+
3219
+ saved_step = FullDumpLoader(
3220
+ name=path,
3221
+ stripped_saver=self.stripped_saver
3222
+ ).load(context_for_loading, True)
3223
+
3224
+
3182
3225
.. seealso::
3183
3226
:class:`ExecutionContext`
3184
3227
:class:`BaseStep`,
0 commit comments