Search code examples
pythonpipelineamazon-sagemakerhyperparameters

SageMaker: PipelineModel and Hyperparameter Tuning


We want to tune a SageMaker PipelineModel with a HyperparameterTuner (or something similar) where several components of the pipeline have associated hyperparameters. Both components in our case are realized via SageMaker containers for ML algorithms.

model = PipelineModel(..., models = [ our_model, xgb_model ])
deploy = Estimator(image_uri = model, ...)
...
tuner = HyperparameterTuner(deply, .... tune_parameters, ....)
tuner.fit(...)

Now, there is of course the problem how to distribute the tune_parameters to the pipeline steps during the tuning.

In scikit-learn this is achieved by specially naming the tuning parameters <StepName>__<ParameterName>.

I don't see a way to achieve something similar with SageMaker, though. Also, search of the two keywords brings up the same question here but is not really what we want to do.

Any suggestion how to achieve this?


Solution

  • If both the models need to be jointly optimized, you could run a SageMaker HPO job in script mode and define both the models in the script. Or you could run two HPO jobs, optimize each model, and then create the Pipeline Model. There is no native support for doing an HPO job on a PipelineModel.

    I work at AWS and my opinions are my own.