!kubectl config set-context $(kubectl config current-context) --namespace=kubeflow

"""
Explanation: Train Various Models on MNIST using kubeflow and seldon-core
Using:

kubeflow
seldon-core

The example will be the MNIST handwriiten digit classification task.

Dependencies

Argo

Setup
End of explanation
"""


!pygmentize ../workflows/training-tf-mnist-workflow.yaml

!argo submit ../workflows/training-tf-mnist-workflow.yaml -p tfjob-version-hack=1

!argo list

"""
Explanation: Tensorflow Model
A simple neural network in Tensorflow.
Training

Create image from source
Run training

Run with:
  * -p build-push-image=true to build image and push to repo, needed extra params:
    * -p version=&lt;version&gt; create &lt;version&gt; of model
    * -p github-user=&lt;github-user&gt; to download example-seldon source from &lt;github-user&gt; account
    * -p github-revision=&lt;revision&gt; to use the github branch &lt;revision&gt;
    * -p docker-org=&lt;docker-org&gt; to use Docker repo &lt;docker-org&gt; to push image to. Needs docker credentials in secret as described in README.
End of explanation
"""


!pygmentize ../workflows/serving-tf-mnist-workflow.yaml

!argo submit ../workflows/serving-tf-mnist-workflow.yaml

!argo list

"""
Explanation: Runtime Image
Run with:
  * -p build-push-image=true to build image and push to repo, needed extra params:
    * -p version=&lt;version&gt; create &lt;version&gt; of model
    * -p github-user=&lt;github-user&gt; to download example-seldon source from &lt;github-user&gt; account
    * -p github-revision=&lt;revision&gt; to use the github branch &lt;revision&gt;
    * -p docker-org=&lt;docker-org&gt; to use Docker user &lt;docker-org&gt; to push image to. Needs docker credentials in secret as described in README.
  * -p deploy-model=true to deploy model
End of explanation
"""


!pygmentize ../workflows/training-sk-mnist-workflow.yaml

!argo submit ../workflows/training-sk-mnist-workflow.yaml

!argo list

"""
Explanation: Sklearn Model
A Random forest in sklearn.
Training

For options see above Tensorflow example
End of explanation
"""


!pygmentize ../workflows/serving-sk-mnist-workflow.yaml

!argo submit ../workflows/serving-sk-mnist-workflow.yaml

!argo list

"""
Explanation: Runtime Image

For options see above Tensorflow example
End of explanation
"""


!pygmentize ../workflows/training-r-mnist-workflow.yaml

!argo submit ../workflows/training-r-mnist-workflow.yaml

!argo list

"""
Explanation: R Model
A partial least squares model in R.
Training

For options see above Tensorflow example
End of explanation
"""


!pygmentize ../workflows/serving-r-mnist-workflow.yaml

!argo submit ../workflows/serving-r-mnist-workflow.yaml

!argo list

"""
Explanation: Runtime Image

For options see above Tensorflow example
End of explanation
"""


