Gaurav Bansal
Gaurav Bansal

Reputation: 5670

How to do hyperparameter tuning on Sagemaker Scikit Learn container?

I'm trying to follow and modify this notebook to incorporate hyperparameter tuning rather than simply build a random forest model. But I'm having trouble understanding how to do that. My first issue is: hyperparameters are set in two cells - first in the cell writing $SCRIPT_FILENAME where n_estimators and min_samples_leaf are set to 10 and 3, respectively, and then again in the cell where launch_training_job() is defined where they are set to 100 and 3, respectively. Why are they defined twice? When I ran the code, it seemed 100 was used for n_estimators, so what was the point of defining it to be 10 earlier?

Second issue, it seems from this post that there is a way to do automatic model tuning. But I don't see examples of how to do this. Can someone share or enlighten me on ways to incorporate hyperparameter tuning into SageMaker Scikit Learn containers?

Upvotes: 1

Views: 1289

Answers (1)

Julien Simon
Julien Simon

Reputation: 2739

HPO is a generic feature in SageMaker, it works the same whatever algo or framework you use. Plenty of examples are available here: https://github.com/awslabs/amazon-sagemaker-examples/tree/master/hyperparameter_tuning

Upvotes: 1

Related Questions