-
Notifications
You must be signed in to change notification settings - Fork 835
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fd05d1
commit 0c14de6
Showing
11 changed files
with
138 additions
and
125 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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
IrisClassifier.sav | ||
sklearn_iris_jsondata.py | ||
sklearn_iris_jsondata.py | ||
sklearn_iris.py |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from sklearn.externals import joblib | ||
import joblib | ||
|
||
class IrisClassifier(object): | ||
|
||
|
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 |
---|---|---|
|
@@ -18,4 +18,4 @@ spec: | |
name: sklearn-iris-classifier | ||
type: MODEL | ||
name: sklearn-iris-predictor | ||
replicas: 1 | ||
replicas: 1 |
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 |
---|---|---|
@@ -1,25 +1,28 @@ | ||
import numpy as np | ||
import os | ||
from sklearn.linear_model import LogisticRegression | ||
import joblib | ||
from sklearn.pipeline import Pipeline | ||
from sklearn.externals import joblib | ||
from sklearn.linear_model import LogisticRegression | ||
from sklearn import datasets | ||
|
||
|
||
OUTPUT_FILE = "IrisClassifier.sav" | ||
|
||
|
||
def main(): | ||
clf = LogisticRegression() | ||
p = Pipeline([('clf', clf)]) | ||
print('Training model...') | ||
clf = LogisticRegression(solver="liblinear", multi_class="ovr") | ||
p = Pipeline([("clf", clf)]) | ||
print("Training model...") | ||
p.fit(X, y) | ||
print('Model trained!') | ||
print("Model trained!") | ||
|
||
print(f"Saving model in {OUTPUT_FILE}") | ||
joblib.dump(p, OUTPUT_FILE) | ||
print("Model saved!") | ||
|
||
|
||
filename_p = 'IrisClassifier.sav' | ||
print('Saving model in %s' % filename_p) | ||
joblib.dump(p, filename_p) | ||
print('Model saved!') | ||
|
||
if __name__ == "__main__": | ||
print('Loading iris data set...') | ||
print("Loading iris data set...") | ||
iris = datasets.load_iris() | ||
X, y = iris.data, iris.target | ||
print('Dataset loaded!') | ||
print("Dataset loaded!") | ||
|
||
main() |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from sklearn.externals import joblib | ||
import joblib | ||
import sys | ||
|
||
|
||
|
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
Oops, something went wrong.