-
Notifications
You must be signed in to change notification settings - Fork 834
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #678 from gsunner/jsondata-example
scikit learn iris model using jsondata example
- Loading branch information
Showing
6 changed files
with
879 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
MODEL_NAME=IrisClassifier | ||
API_TYPE=REST | ||
SERVICE_TYPE=MODEL | ||
PERSISTENCE=0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from sklearn.externals import joblib | ||
import sys | ||
|
||
def eprint(*args, **kwargs): | ||
print(*args, file=sys.stderr, **kwargs) | ||
|
||
class IrisClassifier(object): | ||
|
||
def __init__(self): | ||
self.model = joblib.load('IrisClassifier.sav') | ||
|
||
def predict(self,X,features_names): | ||
eprint("--------------------") | ||
eprint("Input dict") | ||
eprint(X) | ||
eprint("--------------------") | ||
ndarray = X["some_data"]["some_ndarray"] | ||
return self.model.predict_proba(ndarray) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
scikit-learn==0.19.0 | ||
scipy==0.18.1 |
Oops, something went wrong.