forked from kubeflow/pipelines
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* sklearn tests and refactor * adding successful test executions * fixing based on review comments * adding static type checking as part of maketest
- Loading branch information
1 parent
59795cd
commit 6e26436
Showing
9 changed files
with
118 additions
and
8 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,10 @@ | ||
|
||
dev_install: | ||
pip install -e . | ||
pip install -e .[test] | ||
|
||
test: type_check | ||
pytest -W ignore | ||
|
||
type_check: | ||
mypy --ignore-missing-imports sklearnserver |
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
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
Binary file not shown.
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
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,21 @@ | ||
from sklearn import svm | ||
from sklearn import datasets | ||
from sklearnserver import SKLearnModel | ||
import joblib | ||
import os | ||
|
||
model_dir = "/path/to/kfserving/docs/samples/sklearn" | ||
JOBLIB_FILE = "model.joblib" | ||
|
||
def test_model(): | ||
iris = datasets.load_iris() | ||
X, y = iris.data, iris.target | ||
sklearn_model = svm.SVC(gamma='scale') | ||
sklearn_model.fit(X, y) | ||
model_file = os.path.join((model_dir),JOBLIB_FILE) | ||
joblib.dump(value=sklearn_model, filename=model_file) | ||
server = SKLearnModel("sklearnmodel", model_dir) | ||
server.load() | ||
request = X[0:1].tolist() | ||
response = server.predict(request) | ||
assert response == [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
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
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