Skip to content

Commit

Permalink
Add xgboost example using Bayesian optimization (kubeflow#320)
Browse files Browse the repository at this point in the history
* Add xgboost example

* Add comments for ames example
  • Loading branch information
richardsliu authored and k8s-ci-robot committed Jan 15, 2019
1 parent 4a69776 commit 0ed361c
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions examples/xgboost-bayesian-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: "kubeflow.org/v1alpha1"
kind: StudyJob
metadata:
namespace: kubeflow
labels:
controller-tools.k8s.io: "1.0"
name: xgboost-example

spec:
studyName: xgboost-example
owner: crd
optimizationtype: minimize
objectivevaluename: mean_absolute_error
optimizationgoal: 10000
requestcount: 10

parameterconfigs:
- name: --learning-rate
parametertype: double
feasible:
min: "0.05"
max: "0.15"
- name: --n-estimators
parametertype: int
feasible:
min: "10000"
max: "30000"

workerSpec:
goTemplate:
rawTemplate: |-
apiVersion: batch/v1
kind: Job
metadata:
name: {{.WorkerID}}
namespace: kubeflow
spec:
template:
# The training worker uses the Ames housing example found at
# https://github.com/kubeflow/examples/tree/master/xgboost_ames_housing.
# Please first follow the steps and create the required prerequisites.
spec:
containers:
- name: {{.WorkerID}}
image: gcr.io/kubeflow-examples/ames-housing:latest
volumeMounts:
- mountPath: "/mnt/xgboost"
name: datadir
command:
- "python"
- "housing.py"
- "--train-input=/ames_dataset/train.csv"
- "--model-file=/ames_dataset/housing_{{.WorkerID}}.dat"
{{- with .HyperParameters}}
{{- range .}}
- "{{.Name}}={{.Value}}"
{{- end}}
{{- end}}
volumes:
- name: datadir
persistentVolumeClaim:
claimName: claim
restartPolicy: Never
suggestionSpec:
suggestionAlgorithm: "bayesianoptimization"
suggestionParameters:
-
name: "burn_in"
value: "5"
requestNumber: 10

0 comments on commit 0ed361c

Please sign in to comment.