From cebacc42150953ea81d0f5f3a35ea5712e4d227f Mon Sep 17 00:00:00 2001 From: sperlingxx Date: Tue, 2 Jun 2020 20:46:22 +0800 Subject: [PATCH] add example for metric strategies --- examples/v1beta1/metric-strategy-example.yaml | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 examples/v1beta1/metric-strategy-example.yaml diff --git a/examples/v1beta1/metric-strategy-example.yaml b/examples/v1beta1/metric-strategy-example.yaml new file mode 100644 index 00000000000..66a9f9dfc9e --- /dev/null +++ b/examples/v1beta1/metric-strategy-example.yaml @@ -0,0 +1,64 @@ +apiVersion: "kubeflow.org/v1beta1" +kind: Experiment +metadata: + namespace: kubeflow + labels: + controller-tools.k8s.io: "1.0" + name: metric-strategy-example +spec: + objective: + type: maximize + goal: 0.99 + objectiveMetricName: Validation-accuracy + additionalMetricNames: + - Train-accuracy + metricStrategies: + Validation-accuracy: "max" + Train-accuracy: "latest" + algorithm: + algorithmName: tpe + parallelTrialCount: 3 + maxTrialCount: 12 + maxFailedTrialCount: 3 + parameters: + - name: --lr + parameterType: double + feasibleSpace: + min: "0.01" + max: "0.03" + - name: --num-layers + parameterType: int + feasibleSpace: + min: "2" + max: "5" + - name: --optimizer + parameterType: categorical + feasibleSpace: + list: + - sgd + - adam + - ftrl + trialTemplate: + goTemplate: + rawTemplate: |- + apiVersion: batch/v1 + kind: Job + metadata: + name: {{.Trial}} + namespace: {{.NameSpace}} + spec: + template: + spec: + containers: + - name: {{.Trial}} + image: docker.io/kubeflowkatib/mxnet-mnist + command: + - "python3" + - "/opt/mxnet-mnist/mnist.py" + - "--batch-size=64" + {{- with .HyperParameters}} + {{- range .}} + - "{{.Name}}={{.Value}}" + {{- end}} + {{- end}} + restartPolicy: Never