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
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ author: bjcmit
6
6
ms.author: brysmith
7
7
ms.service: machine-learning
8
8
ms.topic: tutorial
9
-
ms.date: 02/10/2020
9
+
ms.date: 03/13/2020
10
10
---
11
11
12
12
# Tutorial: Convert ML experimental code to production code
@@ -25,7 +25,7 @@ In this tutorial, you learn how to:
25
25
## Prerequisites
26
26
27
27
- Generate the [MLOpsPython template](https://github.com/microsoft/MLOpsPython/generate)
28
-
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
+
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. You can find these notebooks at [https://github.com/microsoft/MLOpsPython/tree/master/experimentation](https://github.com/microsoft/MLOpsPython/tree/master/experimentation).
29
29
- Install nbconvert. Follow only the installation instructions under section __Installing nbconvert__ on the [Installation](https://nbconvert.readthedocs.io/en/latest/install.html) page.
30
30
31
31
## Remove all nonessential code
@@ -70,7 +70,7 @@ Second, the Jupyter code needs to be refactored into functions. Refactoring code
70
70
In `experimentation/Diabetes Ridge Regression Training.ipynb`, complete the following steps:
71
71
72
72
1. Create a function called `train_model`, which takes the parameters `data` and `alpha` and returns a model.
73
-
1. Copy the code under the headings “Train Model on Training Set” and “Validate Model on Validation Set” into the `train_model` function.
73
+
1. Copy the code under the headings "Train Model on Training Set" and "Validate Model on Validation Set" into the `train_model` function.
74
74
75
75
The `train_model` function should look like the following code:
76
76
@@ -84,7 +84,7 @@ def train_model(data, alpha):
84
84
return reg
85
85
```
86
86
87
-
Once the `train_model` function is created, replace the code under the headings “Train Model on Training Set” and “Validate Model on Validation Set” with the following statement:
87
+
Once the `train_model` function is created, replace the code under the headings "Train Model on Training Set" and "Validate Model on Validation Set" with the following statement:
88
88
89
89
```python
90
90
reg = train_model(data, alpha)
@@ -95,7 +95,7 @@ The previous statement calls the `train_model` function passing the `data` and `
95
95
In `experimentation/Diabetes Ridge Regression Training.ipynb`, complete the following steps:
96
96
97
97
1. Create a new function called `main`, which takes no parameters and returns nothing.
98
-
1. Copy the code under the headings “Load Data”, “Split Data into Training and Validation Sets”, and “Save Model” into the `main` function.
98
+
1. Copy the code under the headings "Load Data", "Split Data into Training and Validation Sets", and "Save Model" into the `main` function.
99
99
1. Copy the newly created call to `train_model` into the `main` function.
100
100
101
101
The `main` function should look like the following code:
@@ -118,7 +118,7 @@ def main():
118
118
joblib.dump(value=reg, filename=model_name)
119
119
```
120
120
121
-
Once the `main` function is created, replace all the code under the headings “Load Data”, “Split Data into Training and Validation Sets”, and “Save Model” along with the newly created call to `train_model` with the following statement:
121
+
Once the `main` function is created, replace all the code under the headings "Load Data", "Split Data into Training and Validation Sets", and "Save Model" along with the newly created call to `train_model` with the following statement:
122
122
123
123
```python
124
124
main()
@@ -166,7 +166,7 @@ main()
166
166
In `experimentation/Diabetes Ridge Regression Scoring.ipynb`, complete the following steps:
167
167
168
168
1. Create a new function called `init`, which takes no parameters and return nothing.
169
-
1. Copy the code under the “Load Model” heading into the `init` function.
169
+
1. Copy the code under the "Load Model" heading into the `init` function.
170
170
171
171
The `init` function should look like the following code:
172
172
@@ -177,7 +177,7 @@ def init():
177
177
model = joblib.load(model_path)
178
178
```
179
179
180
-
Once the `init` function has been created, replace all the code under the heading “Load Model” with a single call to `init` as follows:
180
+
Once the `init` function has been created, replace all the code under the heading "Load Model" with a single call to `init` as follows:
181
181
182
182
```python
183
183
init()
@@ -191,7 +191,7 @@ In `experimentation/Diabetes Ridge Regression Scoring.ipynb`, complete the follo
191
191
{"result": result.tolist()}
192
192
```
193
193
194
-
1. Copy the code under the “Prepare Data”and“Score Data” headings into the `run` function.
194
+
1. Copy the code under the "Prepare Data"and"Score Data" headings into the `run` function.
195
195
196
196
The `run` function should look like the following code (Remember to remove the statements that set the variables `raw_data`and`request_headers`, which will be used later when the `run` function is called):
197
197
@@ -204,7 +204,7 @@ In `experimentation/Diabetes Ridge Regression Scoring.ipynb`, complete the follo
204
204
return {"result": result.tolist()}
205
205
```
206
206
207
-
Once the `run` function has been created, replace all the code under the “Prepare Data”and“Score Data” headings with the following code:
207
+
Once the `run` function has been created, replace all the code under the "Prepare Data"and"Score Data" headings with the following code:
0 commit comments