SKLearn Model Server
Enterprise
    Applicable to Enterprise Edition
  
  Deploy
    Applicable to Deploy Edition
  
Model Information
基本資訊
| Property | Description | 
|---|---|
| Model Image | seldonio/sklearnserver_rest:1.3.0 | 
| Input | ndarray | 
| Output | ndarray | 
| Repository | Link | 
Model URI 檔案結構
<model uri>
└── model.joblib
- model.joblib: joblib輸出模型檔。 詳細資訊,請見 scikit-learn Model persistence。
How It Works
完整範例代碼,請見 Github。
摘要代碼
Load the model
def __init__(self, model_uri):
    model_file = load_from_model_uri(model_uri)
    self._joblib = joblib.load(model_file)
Predict
def predict(self, X):
    return self._joblib.predict_proba(X)
Example
範例採用 scikit-learn iris dataset
| Property | Description | 
|---|---|
| Model Image | seldonio/sklearnserver_rest:1.3.0 | 
| Model URI | gs://seldon-models/sklearn/iris | 
請求範例
curl -X POST http://localhost:5000/api/v1.0/predictions \
    -H 'Content-Type: application/json' \
    -d '{ "data": {"tensor": {"shape": [1, 4], "values": [5.3, 3.5, 1.4, 0.2]}} }'
回應範例
{"data":{"names":["t:0","t:1","t:2"],"tensor":{"shape":[1,3],"values":[0.8700986370655746,0.1298937698872714,7.593047154034911e-06]}},"meta":{}}
