-
Notifications
You must be signed in to change notification settings - Fork 443
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 an example of Goptuna suggestion service #1155
Conversation
I'm in two minds which example should I add, mxnet-mnist or Himmelblau-function. Himmelblau function https://en.wikipedia.org/wiki/Himmelblau%27s_function This function is quite simple and we can evaluate so fast. But it's not a realistic problem and we need to add CI setting to build docker image. import argparse
import logging
logging.basicConfig(filename='/var/log/katib.log', level=logging.DEBUG)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--x1", dest='x1', type=float)
parser.add_argument("--x2", dest='x2', type=float)
args = parser.parse_args()
print(args.x1, args.x2)
evaluation = (args.x1 ** 2 + args.x2 - 11.0) ** 2 + (args.x1 + args.x2 ** 2 - 7.0) ** 2
metric_msg = f'{{metricName: evaluation, metricValue: {evaluation:.4f}}};'
logging.info(metric_msg)
print(metric_msg)
if __name__ == '__main__':
main()
experimentapiVersion: "kubeflow.org/v1alpha3"
kind: Experiment
metadata:
namespace: kubeflow
labels:
controller-tools.k8s.io: "1.0"
name: cmaes-example
spec:
objective:
type: minimize
goal: 0.0001
objectiveMetricName: evaluation
algorithm:
algorithmName: cmaes
metricsCollectorSpec:
source:
filter:
metricsFormat:
- "{metricName: ([\\w|-]+), metricValue: ((-?\\d+)(\\.\\d+)?)}"
fileSystemPath:
path: "/var/log/katib.log"
kind: File
collector:
kind: File
parallelTrialCount: 2
maxTrialCount: 250
maxFailedTrialCount: 3
parameters:
- name: x1
parameterType: double
feasibleSpace:
min: "-10"
max: "10"
- name: x2
parameterType: iint
feasibleSpace:
min: "-10"
max: "10"
step: "2"
trialTemplate:
goTemplate:
rawTemplate: |-
apiVersion: batch/v1
kind: Job
metadata:
name: {{.Trial}}
namespace: {{.NameSpace}}
spec:
template:
spec:
containers:
- name: {{.Trial}}
image: docker.io/cbata/hello-katib-quadratic-function
command:
- "python3"
- "main.py"
{{- with .HyperParameters}}
{{- range .}}
- "--{{.Name}} {{.Value}}"
{{- end}}
{{- end}}
restartPolicy: Never |
/assign @andreyvelich |
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gaocegege The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@c-bata I think, let's keep mxnet for now. If we decide that users needs another example, we can submit Himmelblau function training container. |
I see. Thanks! |
What this PR does / why we need it:
Add an example of Goptuna suggestion service.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Part of #1152
Special notes for your reviewer:
tpe-example
. I just change the name and algorithm name.--optimizer
param is sampled by Goptuna independent sampler (default: random sampler).Release note: