This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kind: AuthorizationPolicy | |
apiVersion: security.istio.io/v1beta1 | |
metadata: | |
name: allow-to-example-model | |
namespace: example-model | |
spec: | |
action: ALLOW | |
rules: | |
- when: | |
- key: "request.auth.claims[email]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kind: RequestAuthentication | |
apiVersion: security.istio.io/v1beta1 | |
metadata: | |
name: enforce-jwt-for-apis | |
namespace: api | |
spec: | |
jwtRules: | |
- audiences: | |
- ml | |
fromHeaders: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: ISTIO_ENABLED | |
value: 'true' | |
- name: ISTIO_GATEWAY | |
value: api/seldon-gateway | |
- name: ISTIO_TLS_MODE | |
value: STRICT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: machinelearning.seldon.io/v1alpha2 | |
kind: SeldonDeployment | |
metadata: | |
name: example | |
namespace: example-model | |
spec: | |
name: example | |
predictors: | |
- componentSpecs: | |
- spec: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.ensemble import RandomForestClassifier | |
from sklearn import datasets | |
import bentoml | |
from bentoml.adapters import DataframeInput | |
from bentoml.frameworks.sklearn import SklearnModelArtifact | |
def train(): | |
iris = datasets.load_iris() | |
X = iris.data | |
y = iris.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import joblib | |
from flask import Flask, request | |
import numpy as np | |
import os | |
app = Flask(__name__) | |
model = None | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: batch/v1 | |
kind: Job | |
metadata: | |
name: training-job | |
spec: | |
template: | |
spec: | |
containers: | |
- name: train-model | |
image: bdrci/k8s-model-trainer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn import datasets | |
from sklearn import svm | |
import joblib | |
def train(data): | |
clf = svm.SVC(gamma=0.001, C=100.) | |
clf.fit(data.data[:-1], data.target[:-1]) | |
return clf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# data generation functions | |
def normalize(x): | |
mu = np.mean(x) | |
sigma = np.std(x) | |
return np.array([(elem - mu)/float(sigma) for elem in x]) | |
def generate_data(n_obs, changepoint_time): | |
# Features | |
X = pd.DataFrame({'day': np.arange(1, n_obs + 1), | |
'weight_kg': np.random.normal(5000, 500, n_obs), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Snippet deleted due to copyright violation |
NewerOlder