Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: supplying hyperparameters to training step constructor drops hyperparameters specified in estimator#144

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
shivlaks merged 4 commits intomainfromshivlaks/trainingstep
Jun 18, 2021

Conversation

@shivlaks
Copy link
Contributor

@shivlaksshivlaks commentedJun 14, 2021
edited
Loading

Summary

Hyperparameters can be specified in theestimator object andhyperparameters property.
Both of which are taken in the constructor of theTrainingStep class.

The current behaviour drops any hyperparameters that were specified in the estimator if the property
is set in theTrainingStep constructor. This is undesirable as the estimators often specify algorithm specific hyperparameters out of the box that we don't want to drop.

This change merges the hyperparameters in the constructor as well as the estimator that is used inTrainingStep.
If there are duplicate keys, the hyperparameters specified in the constructor will be used.

Closes#99,#72


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@shivlaksshivlaks requested a review fromwong-aJune 14, 2021 21:45
parameters['HyperParameters']=hyperparameters
merged_hyperparameters= {}
ifestimator.hyperparameters()isnotNone:
merged_hyperparameters.update(estimator.hyperparameters())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

re:

should we warn/error instead of an in-place merge when we find duplicate keys?

Throwing an error wouldn't be helpful; it's more breaking (you can't create what you could before) and doesn't address the desired functionality in#99. Logging might at an INFO level may be helpful for duplicate keys.

We should also document if not already thatparameters gets totally overridden bytraining_config. This isn't the case for all service integration steps. Maybe we should adopt an update strategy there too?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I was originally thinking that we should log it as a warning sinceINFO tends to generally also include a lot of junk but not strongly opinionated.

I'll re-spin theupdate calls to assemble the dicts so that they log something on duplicate keys.
absolutely agree that we need to document.

This isn't the case for all service integration steps. Maybe we should adopt an update strategy there too?

great call. wasn't on my radar, but I'm in favour of adopting the update strategy. The most consistent it is across things in the SDK, the more intuitive and idiomatic it will feel for users.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'll make the changes to service integration steps in a separate PR. let me know if you had a different thought/idea of where we should be documenting this behaviour@wong-a

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I meant the other way around actually. In all service integration steps besides sagemaker, the constructor accepts aparameters argument that becomesParameters . We can update sagemaker step classes to accept aparameters dict which can be an escape hatch for full API coverage or override any explicitly exposed arguments.

For example, DynamoDBUpdateItem the caller must specify all parameters in theparameters field. The constructor doesn't have atable_name argument to set or other required fields:
https://github.com/aws/aws-step-functions-data-science-sdk-python/blob/main/src/stepfunctions/steps/service.py#L140-L167

Whereas the sagemaker steps always construct parameters using the sagemaker SDK and some special arguments in the constructor. You could provideparameters because the constructor accepts**kwargs, but it won't do anything.
https://github.com/aws/aws-step-functions-data-science-sdk-python/blob/main/src/stepfunctions/steps/sagemaker.py#L477-L479

shivlaks reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I see what you mean. I'm in favour of adding that parameters property and will address it in another PR. Escape hatches are powerful because it'll give users a path forward without requiring first class support to be developed and released.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yeah, that's out of scope of this PR. Can you create an issue for tracking?

shivlaks reacted with thumbs up emoji
@shivlaksshivlaks changed the title[DRAFT] fix: supplying hyperparameters to training step constructor drops hyperparameters specified in estimatorfix: supplying hyperparameters to training step constructor drops hyperparameters specified in estimatorJun 17, 2021
@shivlaksshivlaks marked this pull request as ready for reviewJune 17, 2021 16:43
Copy link
Contributor

@wong-awong-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM besides making documentation clearer

wong-a
wong-a previously approved these changesJun 17, 2021
Copy link
Contributor

@wong-awong-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

< ship it > ---------        \   ^__^         \  (oo)\_______            (__)\       )\/\                ||----w |                ||     ||

ca-nguyen reacted with laugh emoji
ca-nguyen
ca-nguyen previously approved these changesJun 18, 2021
@shivlaksshivlaks dismissed stale reviews fromca-nguyen andwong-a viac431f7cJune 18, 2021 05:40
@StepFunctions-Bot
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-sEHrOdk7acJc
  • Commit ID:c431f7c
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered bygithub-codebuild-logs, available on theAWS Serverless Application Repository

@shivlaksshivlaks merged commit349fc11 intomainJun 18, 2021
shivlaks added a commit that referenced this pull requestJun 21, 2021
bump for `v2.2.0` which includes the following changes:Features* Placeholders in TrainingStep to set S3 location for InputDataConfig and OutputDataConfig (#142)* EventBridge service integration (#147)Fixes* supplying hyperparameters to training step constructor drops hyperparameters specified in estimator (#144)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

2 more reviewers

@ca-nguyenca-nguyenca-nguyen approved these changes

@wong-awong-awong-a left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Enhancement: TrainingStep hyperparameters updating the estimator ones

4 participants

@shivlaks@StepFunctions-Bot@wong-a@ca-nguyen

[8]ページ先頭

©2009-2025 Movatter.jp