Skip to content

Commit

Permalink
feat: add new classifier with scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
solygambas committed Jan 9, 2024
1 parent 9ed5834 commit eda9ecb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion 38-github-actions/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# Open classifier in global scope
# with open("models/wine.pkl", "rb") as file:
with open("models/wine-95.pkl", "rb") as file:
with open("models/wine-95-fixed.pkl", "rb") as file:
clf = pickle.load(file)


Expand Down
14 changes: 14 additions & 0 deletions 38-github-actions/app/test_clf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import pickle
from main import clf
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler


def test_accuracy():
Expand All @@ -16,3 +18,15 @@ def test_accuracy():

# Accuracy should be over 90%
assert acc > 0.9

def test_pipeline_and_scaler():

# Check if clf is an instance of sklearn.pipeline.Pipeline
isPipeline = isinstance(clf, Pipeline)
assert isPipeline

if isPipeline:
# Check if first step of pipeline is an instance of
# sklearn.preprocessing.StandardScaler
firstStep = [v for v in clf.named_steps.values()][0]
assert isinstance(firstStep, StandardScaler)

0 comments on commit eda9ecb

Please sign in to comment.