'Recursively iterate through all objects in the pipeline and set a given parameter.
Parameters
pipeline_steps: array-like
List of (str, obj) tuples from a scikit-learn pipeline or related object
parameter: str
The parameter to assign a value for in each pipeline object
value: any
The value to assign the parameter to in each pipeline object
Returns
None'

def _set_param_recursive(self, pipeline_steps, parameter, value):

    for (_, obj) in pipeline_steps:
        recursive_attrs = ['steps', 'transformer_list', 'estimators']
        for attr in recursive_attrs:
            if hasattr(obj, attr):
                self._set_param_recursive(getattr(obj, attr), parameter, value)
                break
        else:
            if hasattr(obj, parameter):
                setattr(obj, parameter, value)
