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

Add the explanation of how to sample the best expected params to FAQ #5339

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nabenabe0928
Copy link
Collaborator

Motivation

As some people would like to get the best parameters that are not affected by the random noise effect, I added the guide on how to sample the expected best parameters using the GPSampler introduced in v3.6.0.

Description of the changes

I added the description of the way to sample the best expected parameters.

Copy link

codecov bot commented Mar 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.65%. Comparing base (feabc84) to head (ad71cfd).
Report is 271 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5339   +/-   ##
=======================================
  Coverage   89.64%   89.65%           
=======================================
  Files         210      210           
  Lines       13289    13288    -1     
=======================================
  Hits        11913    11913           
+ Misses       1376     1375    -1     

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

@nzw0301 nzw0301 added the document Documentation related. label Mar 19, 2024
@eukaryo
Copy link
Collaborator

eukaryo commented Mar 19, 2024

@contramundum53 @HideakiImamura Could you review this PR?

@@ -714,3 +714,66 @@ Optuna may sometimes suggest parameters evaluated in the past and if you would l

study = optuna.create_study()
study.optimize(objective, n_trials=100)

How can I sample the best expected parameters based on the evaluated trials?
Copy link
Member

Choose a reason for hiding this comment

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

I think some people need the parameters without sampling a new trial, so maybe it's beneficial to introduce the non-sampler way that directly uses _gp classes?

Copy link
Member

Choose a reason for hiding this comment

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

Also it should be pointed out that this is a "hack" and it is not officially supported. It is possible that the interface changes in the future.

Copy link
Contributor

This pull request has not seen any recent activity.

@github-actions github-actions bot added the stale Exempt from stale bot labeling. label Mar 27, 2024
@nabenabe0928 nabenabe0928 removed the stale Exempt from stale bot labeling. label Apr 3, 2024
Copy link
Member

@nzw0301 nzw0301 left a comment

Choose a reason for hiding this comment

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

Let me leave a minor comments. I also think some references to gaussian processes would be helpful to understand the technical terms, such as UCB and acquisition function, especially for users who are not familiar with gaussian processes.


As the optimization often overtunes the parameters of an objective function with an observational noise, it is convenient to sample the best parameters based on the debiased objective function.
:class:`~optuna.samplers.GPSampler` enables us to sample the best expected parameters using the mean estimation of parameters.
Note that the best expected parameters are defined as :math:`\mathrm{arg}\min_{x \in X} \mathbb{E}_{f}[f(x)]` where :math:`f` follows the Gaussian process.
Copy link
Member

@nzw0301 nzw0301 Apr 4, 2024

Choose a reason for hiding this comment

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

Is $X$ a set of suggested params in a trial? Is $x$ one param in the suggested params as in the example below? Can we clarify $X$ and $x$ here?

def objective(trial, evaluate_func=True):
X = np.array([trial.suggest_float(f"x{i}", -5, 5) for i in range(2)])
if evaluate_func:
# Could be a very expensive evaluation in practice such as a training of DNN.
Copy link
Member

Choose a reason for hiding this comment

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

I agree that DNN is a widely used abbreviation, but deep neural networks sounds more reader-friendly.

Suggested change
# Could be a very expensive evaluation in practice such as a training of DNN.
# Could be a very expensive evaluation in practice such as a training of deep neural networks.

@HideakiImamura
Copy link
Member

@eukaryo Could you review this PR?

@nabenabe0928 nabenabe0928 added this to the v4.0.0 milestone Apr 13, 2024
Copy link
Collaborator

@eukaryo eukaryo left a comment

Choose a reason for hiding this comment

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

LGTM if the current comments are resolved.

Copy link
Contributor

This pull request has not seen any recent activity.

@github-actions github-actions bot added the stale Exempt from stale bot labeling. label Apr 28, 2024
@nabenabe0928 nabenabe0928 removed the stale Exempt from stale bot labeling. label Apr 29, 2024
Copy link
Contributor

github-actions bot commented May 6, 2024

This pull request has not seen any recent activity.

@github-actions github-actions bot added the stale Exempt from stale bot labeling. label May 6, 2024
@nabenabe0928 nabenabe0928 removed the stale Exempt from stale bot labeling. label May 7, 2024
@HideakiImamura
Copy link
Member

@nabenabe0928 Please address @nzw0301's comments.

Copy link
Contributor

This pull request has not seen any recent activity.

@github-actions github-actions bot added the stale Exempt from stale bot labeling. label May 16, 2024
@nabenabe0928 nabenabe0928 removed the stale Exempt from stale bot labeling. label May 17, 2024
Copy link
Contributor

This pull request has not seen any recent activity.

@github-actions github-actions bot added the stale Exempt from stale bot labeling. label May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
document Documentation related. stale Exempt from stale bot labeling.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants