You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/machine-learning/tutorial-convert-ml-experiment-to-production.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,7 @@ In `experimentation/Diabetes Ridge Regression Training.ipynb`, complete the foll
76
76
77
77
Move the code under the heading *Training Model on Training Set* into the `train_model` function and modify it to return the `reg_model` object. Remove the `args` dictionary, the values will come from the `args` parameter.
78
78
79
-
1. Create a function called `get_model_metrics` which takes parameters `reg_model` and `data`, and evaluates the model then returns a dictionary of metrics for the trained model.
79
+
1. Create a function called `get_model_metrics`, which takes parameters `reg_model` and `data`, and evaluates the model then returns a dictionary of metrics for the trained model.
80
80
81
81
Move the code under the *Validate Model on Validation Set* heading into the `get_model_metrics` function and modify it to return the `metrics` object.
82
82
@@ -164,7 +164,7 @@ def main():
164
164
joblib.dump(value=reg, filename=model_name)
165
165
```
166
166
167
-
At this stage there should be no code remaining in the notebook that is not in a function, other than import statements in the first cell.
167
+
At this stage, there should be no code remaining in the notebook that isn't in a function, other than import statements in the first cell.
168
168
169
169
Add a statement that calls the `main` function.
170
170
@@ -470,7 +470,7 @@ def init():
470
470
471
471
## Create unit tests for each Python file
472
472
473
-
Fourth, unit tests need to be created for each Python file, which protects code against functional regressions and makes it easier to maintain. In this section, you'll be creating unit tests for the functions in `train.py`.
473
+
Fourth, create unit tests for your Python functions. Unit tests protect code against functional regressions and make it easier to maintain. In this section, you'll be creating unit tests for the functions in `train.py`.
474
474
475
475
`train.py` contains multiple functions, but we'll only create a single unit test for the `train_model` function using the Pytest framework in this tutorial. Pytest isn't the only Python unit testing framework, but it's one of the most commonly used. For more information, visit [Pytest](https://pytest.org).
476
476
@@ -480,8 +480,7 @@ A unit test usually contains three main actions:
480
480
- Act on an object
481
481
- Assert what is expected
482
482
483
-
The unit test will call `train_model` with some hard coded data and arguments, and validate that `train_model` acted as expected by using the resulting trained model to make a prediction and comparing that prediction to an expected value.
484
-
If this test starts failing it could mean that the parameters are no longer being applied correctly, or that the correct object is no longer being returned.
483
+
The unit test will call `train_model` with some hard-coded data and arguments, and validate that `train_model` acted as expected by using the resulting trained model to make a prediction and comparing that prediction to an expected value.
0 commit comments