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/how-to-train-scikit-learn.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,6 +107,11 @@ Next, use the YAML file to create and register this custom environment in your w
107
107
108
108
For more information on creating and using environments, see [Create and use software environments in Azure Machine Learning](how-to-use-environments.md).
109
109
110
+
##### [Optional] Create a custom environment with Intel® Extension for Scikit-Learn
111
+
112
+
Want to speed up your scikit-learn scripts on Intel hardware? Try adding [Intel® Extension for Scikit-Learn](https://www.intel.com/content/www/us/en/developer/tools/oneapi/scikit-learn.html) into your conda yaml file and following the subsequent steps detailed above. We will show you how to enable these optimizations later in this example:
In this section, we'll cover how to run a training job, using a training script that we've provided. To begin, you'll build the training job by configuring the command for running the training script. Then, you'll submit the training job to run in Azure Machine Learning.
@@ -132,6 +137,14 @@ Next, create the script file in the source directory.
#### [Optional] Enable Intel® Extension for Scikit-Learn optimizations for more performance on Intel hardware
141
+
142
+
If you have installed Intel® Extension for Scikit-Learn (as demonstrated in the previous section), you can enable the performance optimizations by adding the two lines of code to the top of the script file, as shown below.
143
+
144
+
To learn more about Intel® Extension for Scikit-Learn, visit the package's [documentation](https://intel.github.io/scikit-learn-intelex/).
Now that you have all the assets required to run your job, it's time to build it using the Azure Machine Learning Python SDK v2. For this, we'll be creating a `command`.
Copy file name to clipboardExpand all lines: articles/machine-learning/tutorial-azure-ml-in-a-day.md
+121Lines changed: 121 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -219,6 +219,127 @@ You might need to select **Refresh** to see the new folder and script in your **
219
219
220
220
:::image type="content" source="media/tutorial-azure-ml-in-a-day/refresh.png" alt-text="Screenshot shows the refresh icon.":::
221
221
222
+
### [Optional] Enable Intel® Extension for Scikit-Learn optimizations for more performance on Intel hardware
223
+
224
+
Want to speed up your scikit-learn scripts on Intel hardware? Try enabling [Intel® Extension for Scikit-Learn](https://www.intel.com/content/www/us/en/developer/tools/oneapi/scikit-learn.html) in your training script. Intel® Extension for Scikit-Learn is already installed in the Azure Machine Learning curated environment used in this tutorial, so no additional installation is needed.
225
+
226
+
To learn more about Intel® Extension for Scikit-Learn, visit the package's [documentation](https://intel.github.io/scikit-learn-intelex/).
227
+
228
+
If you want to use Intel® Extension for Scikit-Learn as part of the training script described above, you can enable the performance optimizations by adding the two lines of code to the top of the script file, as shown below.
229
+
230
+
231
+
```python
232
+
%%writefile {train_src_dir}/main.py
233
+
import os
234
+
import argparse
235
+
236
+
# Import and enable Intel Extension for Scikit-learn optimizations
237
+
# where possible
238
+
from sklearnex import patch_sklearn
239
+
patch_sklearn()
240
+
241
+
import pandas as pd
242
+
import mlflow
243
+
import mlflow.sklearn
244
+
from sklearn.ensemble import GradientBoostingClassifier
245
+
from sklearn.metrics import classification_report
246
+
from sklearn.model_selection import train_test_split
247
+
248
+
defmain():
249
+
"""Main function of the script."""
250
+
251
+
# input and output arguments
252
+
parser = argparse.ArgumentParser()
253
+
parser.add_argument("--data", type=str, help="path to input data")
0 commit comments