Skip to content

Commit a5a7ef9

Browse files
author
Larry
committed
feedbback
1 parent 6834e29 commit a5a7ef9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

articles/machine-learning/tutorial-convert-ml-experiment-to-production.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ In this tutorial, you learn how to:
2525

2626
- Generate the [MLOpsPython template](https://github.com/microsoft/MLOpsPython/generate)
2727
and use the `experimentation/Diabetes Ridge Regression Training.ipynb` and `experimentation/Diabetes Ridge Regression Scoring.ipynb` notebooks. These notebooks are used as an example of converting from experimentation to production.
28-
- Install nbconvert. Follow only the installation instructions under the Installing nbconvert section on the [Installation](https://nbconvert.readthedocs.io/en/latest/install.html) page.
28+
- Install nbconvert. Follow only the installation instructions under section __Installing nbconvert__ on the [Installation](https://nbconvert.readthedocs.io/en/latest/install.html) page.
2929

3030
## Remove all nonessential code
3131

32-
Some code written during experimentation is only intended for exploratory purposes. Therefore, the first step to convert experimental code into production code is to remove this nonessential code. Removing nonessential code will also make the code more maintainable. In this section, you'll remove code from the Diabetes Ridge Regression Training notebook. The statements printing the shape of `X` and `y` and the cell calling `features.describe` are just for data exploration and can be removed. After removing nonessential code, `experimentation/Diabetes Ridge Regression Training.ipynb` should look like the following code without markdown:
32+
Some code written during experimentation is only intended for exploratory purposes. Therefore, the first step to convert experimental code into production code is to remove this nonessential code. Removing nonessential code will also make the code more maintainable. In this section, you'll remove code from the `experimentation/Diabetes Ridge Regression Training.ipynb` notebook. The statements printing the shape of `X` and `y` and the cell calling `features.describe` are just for data exploration and can be removed. After removing nonessential code, `experimentation/Diabetes Ridge Regression Training.ipynb` should look like the following code without markdown:
3333

3434
```python
3535
from sklearn.datasets import load_diabetes
@@ -86,7 +86,8 @@ Once the `train_model` function is created, replace the code under the headings
8686
```python
8787
reg = train_model(data, alpha)
8888
```
89-
The previous statement calls the `train_model` function passing the `data` and `alpha` parameters and returns the model
89+
90+
The previous statement calls the `train_model` function passing the `data` and `alpha` parameters and returns the model.
9091

9192
In `experimentation/Diabetes Ridge Regression Training.ipynb`, complete the following steps:
9293

@@ -180,7 +181,7 @@ init()
180181

181182
In `experimentation/Diabetes Ridge Regression Scoring.ipynb`, complete the following steps:
182183

183-
1. Create a new function called `run`, which takes raw_data and request_headers as parameters and returns a dictionary of results as follows:
184+
1. Create a new function called `run`, which takes `raw_data` and `request_headers` as parameters and returns a dictionary of results as follows:
184185

185186
```python
186187
{"result": result.tolist()}
@@ -348,7 +349,7 @@ A unit test usually contains three main actions:
348349
- Act on an object
349350
- Assert what is expected
350351

351-
A common condition for `train_model` is when `data` and an `alpha` value are passed. The expected result is that the `Ridge.train` and `Ridge.predict` functions should be called. Since machine learning training methods are usually not fast-running, the call to `Ridge.train` will be mocked. Because the return value of `Ridge.train` is a mocked object, we'll also mock `Ridge.predict`. The unit test for `train_model` testing the passing of `data` and an `alpha` value with the expected result of `Ridge.train` and `Ridge.predict` functions being called using mocking and the Pytest framework should look like the following code:
352+
A common condition for `train_model` is when `data` and an `alpha` value are passed. The expected result is that the `Ridge.train` and `Ridge.predict` functions should be called. Since machine learning training methods are often not fast-running, the call to `Ridge.train` will be mocked. Because the return value of `Ridge.train` is a mocked object, we'll also mock `Ridge.predict`. The unit test for `train_model` testing the passing of `data` and an `alpha` value with the expected result of `Ridge.train` and `Ridge.predict` functions being called using mocking and the Pytest framework should look like the following code:
352353

353354
```python
354355
import pytest

0 commit comments

Comments
 (0)