Skip to content
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

Replace StudySummary to FrozenStudy in serializing #809

Merged

Conversation

keisuke-umezawa
Copy link
Member

@keisuke-umezawa keisuke-umezawa commented Feb 18, 2024

Contributor License Agreement

This repository (optuna-dashboard) and Goptuna share common code.
This pull request may therefore be ported to Goptuna.
Make sure that you understand the consequences concerning licenses and check the box below if you accept the term before creating this pull request.

  • I agree this patch may be ported to Goptuna by other Goptuna contributors.

Reference Issues/PRs

To make a follow-up PR for #783

What does this implement/fix? Explain your changes.

In optuna v3, to get attribute of a study, FrozenStudy was introduced and it is performance efficient.
As we deprecated optuna v2, we can use it now instead of StudySummary.

Copy link

codecov bot commented Feb 18, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (ead77a9) 69.53% compared to head (9170b88) 69.53%.
Report is 12 commits behind head on main.

❗ Current head 9170b88 differs from pull request most recent head 8f39413. Consider uploading reports for the commit 8f39413 to get more accurate results

Files Patch % Lines
optuna_dashboard/_app.py 75.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #809      +/-   ##
==========================================
- Coverage   69.53%   69.53%   -0.01%     
==========================================
  Files          35       35              
  Lines        2370     2360      -10     
==========================================
- Hits         1648     1641       -7     
+ Misses        722      719       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

summaries = get_study_summaries(storage)
serialized = [serialize_study_summary(summary) for summary in summaries]
studies = get_studies(storage)
serialized = [serialize_frozen_study(s) for s in studies]
return {
"study_summaries": serialized,
Copy link
Member Author

Choose a reason for hiding this comment

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

Should I change the key name of study_summaries and study_summary to something?

Copy link
Member

Choose a reason for hiding this comment

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

Could you add a todo comment? For now, we cannot introduce the breaking changes in JSON Web APIs since our Jupyter Lab extension uses it.

}

if summary.datetime_start is not None:
serialized["datetime_start"] = summary.datetime_start.isoformat()
Copy link
Member Author

Choose a reason for hiding this comment

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

To add datetime_start, I need to add this attribute in FrozenStudy.

Copy link
Member

@c-bata c-bata Feb 20, 2024

Choose a reason for hiding this comment

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

I would say we should drop datetime_start for performance reasons. Could you remove a following line as well?

@nabenabe0928
Copy link
Collaborator

@gen740 @c-bata Could you review this PR?

Copy link
Member

@c-bata c-bata left a comment

Choose a reason for hiding this comment

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

Thank you for your pull request! I left one minor comment.

summaries = get_study_summaries(storage)
serialized = [serialize_study_summary(summary) for summary in summaries]
studies = get_studies(storage)
serialized = [serialize_frozen_study(s) for s in studies]
return {
"study_summaries": serialized,
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a todo comment? For now, we cannot introduce the breaking changes in JSON Web APIs since our Jupyter Lab extension uses it.

@c-bata c-bata merged commit 07b64d8 into optuna:main Feb 22, 2024
13 checks passed
@keisuke-umezawa keisuke-umezawa deleted the feature/use-frozen-study-in-serialize branch February 22, 2024 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants