Skip to content

Commit 18c6903

Browse files
committed
adding new classifier with scaling and preprocessing CI test
1 parent 8439a8c commit 18c6903

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
app = FastAPI(title="Predicting Wine Class with batching")
1010

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

1515

course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/test_clf.py

+12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
import pickle
22
from main import clf
3+
from sklearn.pipeline import Pipeline
4+
from sklearn.preprocessing import StandardScaler
35

6+
def test_pipeline_and_scaler():
7+
# Check if clf is an instance of sklearn.pipeline.Pipeline
8+
isPipeline = isinstance(clf, Pipeline)
9+
assert isPipeline
10+
11+
if isPipeline:
12+
# Check if first step of pipeline is an instance of
13+
# sklearn.preprocessing.StandardScaler
14+
firstStep = [v for v in clf.named_steps.values()][0]
15+
assert isinstance(firstStep, StandardScaler)
416

517
def test_accuracy():
618

0 commit comments

Comments
 (0)