Skip to content

TypeError callling tuner.best_estimator(best_training_job=best_job_name) #1322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jfelectron opened this issue Mar 3, 2020 · 2 comments
Closed

Comments

@jfelectron
Copy link

jfelectron commented Mar 3, 2020

Describe the bug

Fetching best estimator from Tuner by name raises TypeError

To reproduce
A clear, step-by-step set of instructions to reproduce the bug.

  1. Create XGBoost Estimator.
  2. Create HyperparameterTuner with Extimator
  3. After HPO finishes try to get best_estmator from tuner:
    best_job_name = self.tuner.best_training_job()
    best_estimator = self.tuner.best_estimator(best_training_job=best_job_name)

Expected behavior

Estimator is retrieved.

Screenshots or logs
2020-03-03T20:58:52.397Z best_estimator = self.tuner.best_estimator(best_training_job=best_job_name)
2020-03-03T20:58:52.397Z best_estimator = self.tuner.best_estimator(best_training_job=best_job_name)
File "/usr/local/lib/python3.7/site-packages/sagemaker/tuner.py", line 776, in best_estimator
2020-03-03T20:58:52.398Z training_job_name=best_training_job["TrainingJobName"],
2020-03-03T20:58:52.398Z TypeError: string indices must be integers

System information
A description of your system. Please provide:

  • SageMaker Python SDK version: current
  • Framework name (eg. PyTorch) or algorithm (eg. KMeans):
  • Framework version:
  • Python version:
  • CPU or GPU:
  • Custom Docker image (Y/N):

Additional context
Add any other context about the problem here.

@knakad
Copy link
Contributor

knakad commented Mar 6, 2020

Hi Jonathan!

Thanks for reaching out!
I updated the docstring on this method to be clearer. You need to pass in a python dict object containing a couple keys: #1331
I added an Example to the docstring as well to make it easier.

Hope that helps!

@knakad
Copy link
Contributor

knakad commented Mar 6, 2020

( https://sagemaker.readthedocs.io/en/stable/tuner.html will be updated on the next release, scheduled for Monday morning US Pacific time )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants