Skip to content

Commit

Permalink
feat: Suport bo
Browse files Browse the repository at this point in the history
Signed-off-by: Ce Gao <gaoce@caicloud.io>
  • Loading branch information
gaocegege committed May 29, 2019
1 parent b7602a2 commit 32e93ea
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
64 changes: 64 additions & 0 deletions examples/v1alpha2/bayseopt-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apiVersion: "kubeflow.org/v1alpha2"
kind: Experiment
metadata:
namespace: kubeflow
labels:
controller-tools.k8s.io: "1.0"
name: bayseopt-example
spec:
objective:
type: maximize
goal: 0.99
objectiveMetricName: Validation-accuracy
additionalMetricNames:
- accuracy
algorithm:
algorithmName: bayesianoptimization
algorithmSettings:
- name: "burn_in"
value: "5"
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: katib/mxnet-mnist-example
command:
- "python"
- "/mxnet/example/image-classification/train_mnist.py"
- "--batch-size=64"
{{- with .HyperParameters}}
{{- range .}}
- "{{.Name}}={{.Value}}"
{{- end}}
{{- end}}
restartPolicy: Never
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spec:
containers:
- name: katib-suggestion-bayesianoptimization
image: katib/v1alpha2/suggestion-bayesianoptimization
imagePullPolicy: IfNotPresent
ports:
- name: api
containerPort: 6789
3 changes: 3 additions & 0 deletions pkg/suggestion/v1alpha2/bayesian_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def _get_experiment(self, name):
api_pb2.GetExperimentRequest(experiment_name=name), 10)
return exp.experiment

def ValidateAlgorithmSettings(self, request, context):
return api_pb2.ValidateAlgorithmSettingsReply()

def GetSuggestions(self, request, context):
"""
Main function to provide suggestion.
Expand Down

0 comments on commit 32e93ea

Please sign in to comment.