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/algorithm-module-reference/create-python-model.md
+12-6Lines changed: 12 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,11 +28,10 @@ After you create the model, you can use [Train Model](train-model.md) to train t
28
28
Use of this module requires intermediate or expert knowledge of Python. The module supports use of any learner that's included in the Python packages already installed in Azure Machine Learning. See the preinstalled Python package list in [Execute Python Script](execute-python-script.md).
29
29
30
30
> [!NOTE]
31
-
> Please be very careful when writing your script and makes sure there is no syntax error, such as using a un-declared object or a un-imported module. Also pay extra attentions to the pre-installed modules list in [Execute Python Script](execute-python-script.md). To import modules which are not listed, please install the corresponding packages in your script such as
32
-
> ```Python
33
-
>import os
34
-
> os.system(f"pip install scikit-misc")
35
-
>```
31
+
> Please be very careful when writing your script and makes sure there is no syntax error, such as using a un-declared object or a un-imported module.
32
+
33
+
> [!NOTE]
34
+
Also pay extra attentions to the pre-installed modules list in [Execute Python Script](execute-python-script.md). Only import pre-installed modules. Please do not install extra packages such as "pip install xgboost" in this script, otherwise errors will be raised when reading models in down-stream modules.
36
35
37
36
This article shows how to use **Create Python Model** with a simple pipeline. Here's a diagram of the pipeline:
38
37
@@ -54,7 +53,9 @@ This article shows how to use **Create Python Model** with a simple pipeline. He
54
53
# predict: which generates prediction result, the input argument and the prediction result MUST be pandas DataFrame.
55
54
# The signatures (method names and argument names) of all these methods MUST be exactly the same as the following example.
56
55
57
-
56
+
# Please do not install extra packages such as "pip install xgboost" in this script,
57
+
# otherwise errors will be raised when reading models in down-stream modules.
58
+
58
59
import pandas as pd
59
60
from sklearn.naive_bayes import GaussianNB
60
61
@@ -65,10 +66,15 @@ This article shows how to use **Create Python Model** with a simple pipeline. He
65
66
self.feature_column_names =list()
66
67
67
68
deftrain(self, df_train, df_label):
69
+
# self.feature_column_names records the column names used for training.
70
+
# It is recommended to set this attribute before training so that the
71
+
# feature columns used in predict and train methods have the same names.
0 commit comments