(
        self, X, y=None, unsafe=False, **fit_params
    )
partial_fit for a pipeline.
        This method assumes that all but the last node of a pipeline are frozen_trained and
        only the last node needs to be fit using its partial_fit method.

        Parameters
        ----------
        X :
            Features; see partial_fit schema of the last node.
        y:
            Labels/target
        unsafe:
            boolean.
            This flag allows users to override the validation that throws an error when the
            the operators in the prefix of this pipeline are not tagged with `has_partial_transform`.
            Setting unsafe to True would perform the transform as if it was row-wise even in the case it may not be.
        fit_params:
            dict
            Additional keyword arguments to be passed to partial_fit of the estimator

        Returns
        -------
        TrainedPipeline :
            A partially trained pipeline, which can be trained further by other calls to partial_fit
partial_fit for a pipeline.
        This method assumes that all but the last node of a pipeline are frozen_trained and
        only the last node needs to be fit using its partial_fit method.
partial_fit for a pipeline . This method assumes that all but the last node of a pipeline are frozen_trained and only the last node needs to be fit using its partial_fit method .
def partial_fit(
        self, X, y=None, unsafe=False, **fit_params
    ) -> "TrainedPipeline[TrainedIndividualOp]":
        """partial_fit for a pipeline.
        This method assumes that all but the last node of a pipeline are frozen_trained and
        only the last node needs to be fit using its partial_fit method.

        Parameters
        ----------
        X :
            Features; see partial_fit schema of the last node.
        y:
            Labels/target
        unsafe:
            boolean.
            This flag allows users to override the validation that throws an error when the
            the operators in the prefix of this pipeline are not tagged with `has_partial_transform`.
            Setting unsafe to True would perform the transform as if it was row-wise even in the case it may not be.
        fit_params:
            dict
            Additional keyword arguments to be passed to partial_fit of the estimator

        Returns
        -------
        TrainedPipeline :
            A partially trained pipeline, which can be trained further by other calls to partial_fit

        """
        estimator_only = True

        for operator in self._steps[:-1]:
            if not operator.is_frozen_trained():
                estimator_only = False
        if not estimator_only:
            raise ValueError(
                """partial_fit is only supported on pipelines when all but the last node are frozen_trained and
        only the last node needs to be fit using its partial_fit method."""
            )
        if hasattr(self, "_trained"):
            # This is the case where partial_fit has been called before,
            # so the partially fit pipeline is stored in _trained.
            # update that object
            self._trained = self._trained.partial_fit(X, y, **fit_params)
            return self._trained
        else:
            # if this is the first time partial_fit is called on this pipeline,
            # we would not have a _trained obj, so convert the prefix to a trained pipeline
            # explicitly and do a transform and partial_fit as expected.
            sink_node = self._steps[-1]
            pipeline_prefix = self.remove_last()
            trained_pipeline_prefix = pipeline_prefix.convert_to_trained()
            transformed_output = trained_pipeline_prefix.transform(X, y)
            if isinstance(transformed_output, tuple):
                transformed_X, transformed_y = transformed_output
            else:
                transformed_X = transformed_output
                transformed_y = y

            trained_sink_node = sink_node.partial_fit(
                transformed_X, transformed_y, **fit_params
            )
            new_pipeline = trained_pipeline_prefix >> trained_sink_node
            self._trained = new_pipeline
            return new_pipeline
def partial_fit ( self , X , y = None , unsafe = False , * * fit_params ) -> "TrainedPipeline[TrainedIndividualOp]" : estimator_only = True for operator in self . _steps [ : - 1 ] : if not operator . is_frozen_trained ( ) : estimator_only = False if not estimator_only : raise ValueError ( """partial_fit is only supported on pipelines when all but the last node are frozen_trained and
        only the last node needs to be fit using its partial_fit method.""" ) if hasattr ( self , "_trained" ) : # This is the case where partial_fit has been called before, # so the partially fit pipeline is stored in _trained. # update that object self . _trained = self . _trained . partial_fit ( X , y , * * fit_params ) return self . _trained else : # if this is the first time partial_fit is called on this pipeline, # we would not have a _trained obj, so convert the prefix to a trained pipeline # explicitly and do a transform and partial_fit as expected. sink_node = self . _steps [ - 1 ] pipeline_prefix = self . remove_last ( ) trained_pipeline_prefix = pipeline_prefix . convert_to_trained ( ) transformed_output = trained_pipeline_prefix . transform ( X , y ) if isinstance ( transformed_output , tuple ) : transformed_X , transformed_y = transformed_output else : transformed_X = transformed_output transformed_y = y trained_sink_node = sink_node . partial_fit ( transformed_X , transformed_y , * * fit_params ) new_pipeline = trained_pipeline_prefix >> trained_sink_node self . _trained = new_pipeline return new_pipeline