Use get to avoid KeyError (#824)

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
Co-authored-by: Kevin Chen <74878789+int-chaos@users.noreply.github.com>
This commit is contained in:
Chi Wang 2022-12-06 22:23:45 -08:00 committed by GitHub
parent f8fa5258e1
commit dbc2e2d796
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -235,7 +235,7 @@ class SearchState:
n_iter = (
trained_estimator
and hasattr(trained_estimator, "ITER_HP")
and trained_estimator.params[trained_estimator.ITER_HP]
and trained_estimator.params.get(trained_estimator.ITER_HP)
)
if n_iter:
config[trained_estimator.ITER_HP] = n_iter