-
Notifications
You must be signed in to change notification settings - Fork 458
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
[GSOC] optuna
suggestion service logic update
#2446
base: master
Are you sure you want to change the base?
[GSOC] optuna
suggestion service logic update
#2446
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I started reviewing this pr cc: @andreyvelich |
/rerun-all |
@shashank-iitbhu would you please rerun the ci? |
edf98f0
to
f263b26
Compare
@mahdikhashan still working on this PR, need some time. This is based on #2412 , so it makes sense to merge this once #2412 is merged. |
ok, take your time, are there any place which I can offer you help? |
Hi @shashank-iitbhu, #2412 has been merged. We can work on this now! But before that, could you please rebase your PR and resolve the errors in CI? |
@shashank-iitbhu shall we start reviewing it? |
Signed-off-by: Shashank Mittal <shashank.mittal.mec22@itbhu.ac.in>
Co-authored-by: Yuki Iwai <yuki.iwai.tz@gmail.com> Signed-off-by: Shashank Mittal <shashank.mittal.mec22@itbhu.ac.in>
Signed-off-by: Shashank Mittal <shashank.mittal.mec22@itbhu.ac.in>
Signed-off-by: Shashank Mittal <shashank.mittal.mec22@itbhu.ac.in>
f263b26
to
6b18e9b
Compare
Sure, I have rebased this PR also, I will let you know once this is ready for review. |
thank you! feel free to ping me when you're ready. btw, we can also do a progressive review. would it work for you to review the existing code before finalizing it? |
Hi @shashank-iitbhu, we have time until this Wednesday to merge this PR before we cut Katib RC.0. |
Signed-off-by: Shashank Mittal <shashank.mittal.mec22@itbhu.ac.in>
@@ -50,7 +50,7 @@ def setup_method(self): | |||
], | |||
["cmaes", {"restart_strategy": "ipop", "sigma": "2", "random_state": "71"}], | |||
["random", {"random_state": "71"}], | |||
["grid", {"random_state": "71"}], | |||
# ["grid", {"random_state": "71"}], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mahdikhashan @andreyvelich The unit tests are failing for this grid algorithm setting for param-11
and param-12
as here I am not specifying the step in parameters for param_type DOUBLE
.
An Exception Error keeps raising due to call to convert_to_combinations
method
katib/pkg/suggestion/v1beta1/internal/search_space.py
Lines 57 to 62 in 3e736dc
elif parameter.type == DOUBLE: | |
if parameter.step == "" or parameter.step is None: | |
raise Exception( | |
"Param {} step is nil; For discrete search space, all parameters " | |
"must include step".format(parameter.name) | |
) |
katib/pkg/suggestion/v1beta1/optuna/base_service.py
Lines 56 to 59 in 3e736dc
elif self.algorithm_name == "grid": | |
combinations = HyperParameterSearchSpace.convert_to_combinations( | |
self.search_space | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to explicitly check for nil
and set parameter.step
to default 1 but then getting this error while running the unit tests.
E AssertionError: assert <StatusCode.DEADLINE_EXCEEDED: (4, 'deadline exceeded')> == <StatusCode.OK: (0, 'ok')>
How to deal with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can look into this tomorrow in early morning, hope its fine with you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems, to my current understanding of Optuna docs, that for grid algo, we need to have step defined. I'll investigate further with setting step and the second error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to explicitly check for
nil
and setparameter.step
to default 1 but then getting this error while running the unit tests.E AssertionError: assert <StatusCode.DEADLINE_EXCEEDED: (4, 'deadline exceeded')> == <StatusCode.OK: (0, 'ok')>
How to deal with this?
I could not figure out where we can change to handle it - will try to dig deeper later.
Hey @andreyvelich, I just pushed the changes for the unit tests and e2e tests. I’m facing an issue while testing the https://optuna.readthedocs.io/en/stable/reference/distributions.html |
@@ -50,7 +50,7 @@ def setup_method(self): | |||
], | |||
["cmaes", {"restart_strategy": "ipop", "sigma": "2", "random_state": "71"}], | |||
["random", {"random_state": "71"}], | |||
["grid", {"random_state": "71"}], | |||
# ["grid", {"random_state": "71"}], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems, to my current understanding of Optuna docs, that for grid algo, we need to have step defined. I'll investigate further with setting step and the second error.
@@ -50,7 +50,7 @@ def setup_method(self): | |||
], | |||
["cmaes", {"restart_strategy": "ipop", "sigma": "2", "random_state": "71"}], | |||
["random", {"random_state": "71"}], | |||
["grid", {"random_state": "71"}], | |||
# ["grid", {"random_state": "71"}], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @shashank-iitbhu! And also thanks for reviewing this @mahdikhashan! I have no extra comments on this PR. As for the normal distribution, does WDYT @kubeflow/wg-automl-leads @shashank-iitbhu @mahdikhashan @helenxie-bit |
Signed-off-by: Shashank Mittal <shashank.mittal.mec22@itbhu.ac.in>
elif param.distribution == api_pb2.LOG_UNIFORM: | ||
# Log-uniform integer distribution: used for exponentially varying integers. | ||
search_space[param.name] = optuna.distributions.IntDistribution( | ||
low=max(1, int(param.min)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this always be equal to 1 since values are always int
here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not always. The condition ensures that low is at least 1, which is required for log
distributions. It prevents invalid cases where param.min could be 0 or negative.
As specified in the optuna documentation, If log
is True
, low
must be larger than or equal to 1.
step=None, | ||
) | ||
|
||
elif param.type in {CATEGORICAL, DISCRETE}: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use array here ?
elif param.type in {CATEGORICAL, DISCRETE}: | |
elif param.type in [CATEGORICAL, DISCRETE]: |
min: "0.001" | ||
max: "1" | ||
step: "0.1" | ||
distribution: uniform |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add one parameters for Float and LogUniform
Signed-off-by: Shashank Mittal <shashank.mittal.mec22@itbhu.ac.in>
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #2374
Checklist: