Skip to content

docs: clarify n_warmup_steps boundary in MedianPruner and PercentilePruner - #6733

Merged
y0z merged 5 commits into
optuna:masterfrom
vin0san:fix/docstring-n-warmup-steps
Jul 2, 2026
Merged

y0z merged 5 commits into
optuna:masterfrom
vin0san:fix/docstring-n-warmup-steps

Conversation

@vin0san

@vin0san vin0san commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Closes #6732

The docstring said "until the trial exceeds the given number of step" which implies
step > n_warmup_steps, but the implementation uses step < n_warmup_steps, meaning
pruning begins at step == n_warmup_steps. Updated both _median.py and _percentile.py to make the boundary explicit.

Comment thread optuna/pruners/_median.py Resolved
Comment thread optuna/pruners/_percentile.py Outdated
this feature assumes that ``step`` starts at zero.
Pruning is disabled for the first ``n_warmup_steps`` reported steps (steps ``0`` to
``n_warmup_steps - 1``); the earliest a trial can be pruned is at
``step == n_warmup_steps``. This feature assumes that ``step`` starts at zero.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ditto

@nabenabe0928

nabenabe0928 commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Btw, could you, @vin0san , please include @francisco-aparicio as a contributor?
@francisco-aparicio is the one suggested to publish this PR.
And @francisco-aparicio asked us whether he can publish the PR.

Please run git commit --amend and add the following with an empty line between the commit message and the signature below:

Co-authored-by: Francisco Aparício <[email protected]>

@vin0san
vin0san force-pushed the fix/docstring-n-warmup-steps branch from fd0ea8a to a5f4682 Compare July 1, 2026 06:51
@francisco-aparicio

Copy link
Copy Markdown
Contributor

Btw, could you, @vin0san , please include @francisco-aparicio as a contributor? @francisco-aparicio is the one suggested to publish this PR. And @francisco-aparicio asked us whether he can publish the PR.

Please run git commit --amend and add the following with an empty line between the commit message and the signature below:

Co-authored-by: Francisco Aparício <[email protected]>

Thank you, I would appreciate being mentioned as a contributor, best!

@vin0san

vin0san commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Btw, could you, @vin0san , please include @francisco-aparicio as a contributor? @francisco-aparicio is the one suggested to publish this PR. And @francisco-aparicio asked us whether he can publish the PR.
Please run git commit --amend and add the following with an empty line between the commit message and the signature below:

Co-authored-by: Francisco Aparício <[email protected]>

Thank you, I would appreciate being mentioned as a contributor, best!

Done! Added you as a co-author in the latest commit. 🙏

@nabenabe0928 nabenabe0928 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you, @vin0san and @francisco-aparicio :)
I will check the change again!

Comment thread optuna/pruners/_median.py Outdated
n_warmup_steps:
Pruning is disabled until the trial exceeds the given number of step. Note that
this feature assumes that ``step`` starts at zero.
Pruning is disabled for the first ``n_warmup_steps`` reported steps (steps ``0`` to

@nabenabe0928 nabenabe0928 Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe this expression is confusing because step does not increase strictly by 1 per report.

Comment thread optuna/pruners/_median.py Resolved
Comment thread optuna/pruners/_percentile.py Resolved

@nabenabe0928 nabenabe0928 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@y0z y0z added optuna.pruners Related to the `optuna.pruners` submodule. This is automatically labeled by github-actions. document Documentation related. labels Jul 2, 2026

@y0z y0z left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@y0z
y0z merged commit d52c913 into optuna:master Jul 2, 2026
13 checks passed
@y0z y0z added this to the v5.0.0 milestone Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

document Documentation related. optuna.pruners Related to the `optuna.pruners` submodule. This is automatically labeled by github-actions.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docstring for n_warmup_steps is ambiguous about when pruning starts

4 participants