From fc20fc012d07a6c5b722bf8772d3a7ff6d8b5f72 Mon Sep 17 00:00:00 2001 From: oluwafemidiakhoa <38867499+oluwafemidiakhoa@users.noreply.github.com> Date: Thu, 11 Apr 2024 14:22:32 -0500 Subject: [PATCH 1/4] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5d75f6f17..b33b97c93 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Machine Learning Engineering for Production +# Machine Learning Engineering for Production Welcome to the public repo for [deeplearning.ai](https://www.deeplearning.ai/)'s Machine Learning Engineering for Production Specialization. @@ -6,4 +6,4 @@ Here you will find public resources for the courses of this specialization. ## Want to contribute? -At the time being we are not accepting Pull Requests but if you have any suggestion or spot any bug please raise an issue. \ No newline at end of file +At the time being we are not accepting Pull Requests but if you have any suggestion or spot any bug please raise an issue. From 65c74ce3c3a745915d416d96351954b15ff6af0f Mon Sep 17 00:00:00 2001 From: Oluwafemi Idiakhoa Date: Thu, 11 Apr 2024 14:38:42 -0500 Subject: [PATCH 2/4] Adding new classifier --- .../week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/main.py b/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/main.py index 2f94e9ff2..cd5c340a2 100644 --- a/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/main.py +++ b/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/main.py @@ -9,7 +9,7 @@ app = FastAPI(title="Predicting Wine Class with batching") # Open classifier in global scope -with open("models/wine.pkl", "rb") as file: +with open("models/wine-95.pkl", "rb") as file: clf = pickle.load(file) From b2d41e60cb00d5360c93f42f1519195d77106ba2 Mon Sep 17 00:00:00 2001 From: Oluwafemi Idiakhoa Date: Thu, 11 Apr 2024 15:07:22 -0500 Subject: [PATCH 3/4] Adding new classifier with scaling --- .../week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/main.py b/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/main.py index cd5c340a2..cd231e7bb 100644 --- a/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/main.py +++ b/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/main.py @@ -9,7 +9,7 @@ app = FastAPI(title="Predicting Wine Class with batching") # Open classifier in global scope -with open("models/wine-95.pkl", "rb") as file: +with open("models/wine-95-fixed.pkl", "rb") as file: clf = pickle.load(file) From 613439d083821b2b976de5f9046a83a5d0f1465e Mon Sep 17 00:00:00 2001 From: Oluwafemi Idiakhoa Date: Thu, 11 Apr 2024 15:22:34 -0500 Subject: [PATCH 4/4] Adding new classifier with scaling --- .../C4_W3_Lab_4_Github_Actions/app/test_clf.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/test_clf.py b/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/test_clf.py index 2d957fecd..c3e455b06 100644 --- a/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/test_clf.py +++ b/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/test_clf.py @@ -1,9 +1,9 @@ +from sklearn.pipeline import Pipeline +from sklearn.preprocessing import StandardScaler import pickle from main import clf - def test_accuracy(): - # Load test data with open("data/test_data.pkl", "rb") as file: test_data = pickle.load(file) @@ -16,3 +16,14 @@ 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 + is_pipeline = isinstance(clf, Pipeline) + assert is_pipeline + + if is_pipeline: + # Check if the first step of the pipeline is an instance of + # sklearn.preprocessing.StandardScaler + first_step = clf.named_steps.values()[0] + assert isinstance(first_step, StandardScaler)