SKLearn server
Enterprise
Applicable to Enterprise tier only
Model Information
Basic
Property | Description |
---|---|
Model Image | seldonio/sklearnserver_rest:1.3.0 |
Input | ndarray |
Output | ndarray |
Repository | Link |
Model URI Structure
<model uri>
└── model.joblib
- model.joblib: The model file should be saved by the
joblib
format. For more information, please see scikit-learn Model persistence document
How It Works
You can check the detailed code in the Github. Here, we demonstrate by the pseudo-code.
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
The example uses the scikit-learn iris dataset
Property | Description |
---|---|
Model Image | seldonio/sklearnserver_rest:1.3.0 |
Model URI | gs://seldon-models/sklearn/iris |
Test Request
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]}} }'
Test Result
{"data":{"names":["t:0","t:1","t:2"],"tensor":{"shape":[1,3],"values":[0.8700986370655746,0.1298937698872714,7.593047154034911e-06]}},"meta":{}}