Skip to content

Commit 41fa508

Browse files
committed
update samples - test
1 parent e1bfa98 commit 41fa508

30 files changed

+2818
-1718
lines changed

configuration.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"source": [
104104
"import azureml.core\n",
105105
"\n",
106-
"print(\"This notebook was created using version 1.0.72 of the Azure ML SDK\")\n",
106+
"print(\"This notebook was created using version 1.0.72.1 of the Azure ML SDK\")\n",
107107
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
108108
]
109109
},

how-to-use-azureml/automated-machine-learning/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ jupyter notebook
154154
- [auto-ml-continuous-retraining.ipynb](continuous-retraining/auto-ml-continuous-retraining.ipynb)
155155
- Continous retraining using Pipelines and Time-Series TabularDataset
156156

157+
- [auto-ml-classification-text-dnn.ipynb](classification-text-dnn/auto-ml-classification-text-dnn.ipynb)
158+
- Classification with text data using deep learning in AutoML
159+
- AutoML highlights here include using deep neural networks (DNNs) to create embedded features from text data.
160+
- Depending on the compute cluster the user provides, AutoML tried out Bidirectional Encoder Representations from Transformers (BERT) when a GPU compute is used.
161+
- Bidirectional Long-Short Term neural network (BiLSTM) when a CPU compute is used, thereby optimizing the choice of DNN for the uesr's setup.
162+
157163
<a name="documentation"></a>
158164
See [Configure automated machine learning experiments](https://docs.microsoft.com/azure/machine-learning/service/how-to-configure-auto-train) to learn how more about the the settings and features available for automated machine learning experiments.
159165

how-to-use-azureml/automated-machine-learning/automl_env.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ dependencies:
1414
- pandas>=0.22.0,<=0.23.4
1515
- py-xgboost<=0.80
1616
- pyarrow>=0.11.0
17-
- conda-forge::fbprophet==0.5
17+
- fbprophet==0.5
18+
- pytorch=1.1.0
19+
- cudatoolkit=9.0
1820

1921
- pip:
2022
# Required packages for AzureML execution, history, and data preparation.
@@ -23,6 +25,14 @@ dependencies:
2325
- azureml-train
2426
- azureml-widgets
2527
- azureml-explain-model
28+
- azureml-pipeline
2629
- azureml-contrib-interpret
2730
- pandas_ml
28-
31+
- pytorch-transformers==1.0.0
32+
- spacy==2.1.8
33+
- joblib
34+
- https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz
35+
36+
channels:
37+
- conda-forge
38+
- pytorch

how-to-use-azureml/automated-machine-learning/automl_env_mac.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ dependencies:
1515
- pandas>=0.22.0,<0.23.0
1616
- py-xgboost<=0.80
1717
- pyarrow>=0.11.0
18-
- conda-forge::fbprophet==0.5
18+
- fbprophet==0.5
19+
- pytorch=1.1.0
20+
- cudatoolkit=9.0
1921

2022
- pip:
2123
# Required packages for AzureML execution, history, and data preparation.
@@ -24,6 +26,14 @@ dependencies:
2426
- azureml-train
2527
- azureml-widgets
2628
- azureml-explain-model
29+
- azureml-pipeline
2730
- azureml-contrib-interpret
2831
- pandas_ml
29-
32+
- pytorch-transformers==1.0.0
33+
- spacy==2.1.8
34+
- joblib
35+
- https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz
36+
37+
channels:
38+
- conda-forge
39+
- pytorch

how-to-use-azureml/automated-machine-learning/classification-bank-marketing-all-features/auto-ml-classification-bank-marketing-all-features.ipynb

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@
382382
"metadata": {},
383383
"outputs": [],
384384
"source": [
385+
"# Wait for the remote run to complete\n",
385386
"remote_run.wait_for_completion()"
386387
]
387388
},
@@ -463,8 +464,31 @@
463464
"metadata": {},
464465
"source": [
465466
"### Retrieve the Best Model's explanation\n",
466-
"Retrieve the explanation from the best_run which includes explanations for engineered features and raw features.\n",
467+
"Retrieve the explanation from the best_run which includes explanations for engineered features and raw features. Make sure that the run for generating explanations for the best model is completed."
468+
]
469+
},
470+
{
471+
"cell_type": "code",
472+
"execution_count": null,
473+
"metadata": {},
474+
"outputs": [],
475+
"source": [
476+
"# Wait for the best model explanation run to complete\n",
477+
"from azureml.train.automl.run import AutoMLRun\n",
478+
"model_explainability_run_id = remote_run.get_properties().get('ModelExplainRunId')\n",
479+
"print(model_explainability_run_id)\n",
480+
"if model_explainability_run_id is not None:\n",
481+
" model_explainability_run = AutoMLRun(experiment=experiment, run_id=model_explainability_run_id)\n",
482+
" model_explainability_run.wait_for_completion()\n",
467483
"\n",
484+
"# Get the best run object\n",
485+
"best_run, fitted_model = remote_run.get_output()"
486+
]
487+
},
488+
{
489+
"cell_type": "markdown",
490+
"metadata": {},
491+
"source": [
468492
"#### Download engineered feature importance from artifact store\n",
469493
"You can use ExplanationClient to download the engineered feature explanations from the artifact store of the best_run."
470494
]
@@ -475,13 +499,32 @@
475499
"metadata": {},
476500
"outputs": [],
477501
"source": [
478-
"best_run, fitted_model = remote_run.get_output()\n",
479502
"client = ExplanationClient.from_run(best_run)\n",
480503
"engineered_explanations = client.download_model_explanation(raw=False)\n",
481504
"exp_data = engineered_explanations.get_feature_importance_dict()\n",
482505
"exp_data"
483506
]
484507
},
508+
{
509+
"cell_type": "markdown",
510+
"metadata": {},
511+
"source": [
512+
"#### Download raw feature importance from artifact store\n",
513+
"You can use ExplanationClient to download the raw feature explanations from the artifact store of the best_run."
514+
]
515+
},
516+
{
517+
"cell_type": "code",
518+
"execution_count": null,
519+
"metadata": {},
520+
"outputs": [],
521+
"source": [
522+
"client = ExplanationClient.from_run(best_run)\n",
523+
"engineered_explanations = client.download_model_explanation(raw=True)\n",
524+
"exp_data = engineered_explanations.get_feature_importance_dict()\n",
525+
"exp_data"
526+
]
527+
},
485528
{
486529
"cell_type": "markdown",
487530
"metadata": {},
@@ -524,7 +567,8 @@
524567
"cell_type": "markdown",
525568
"metadata": {},
526569
"source": [
527-
"### Predict with the ONNX model, using onnxruntime package"
570+
"### Predict with the ONNX model, using onnxruntime package\n",
571+
"#### Note: The code will install the onnxruntime==0.4.0 if not installed. Newer versions of the onnxruntime have compatibility issues."
528572
]
529573
},
530574
{
@@ -552,12 +596,21 @@
552596
"else:\n",
553597
" python_version_compatible = False\n",
554598
"\n",
599+
"onnxrt_present = False\n",
555600
"try:\n",
556601
" import onnxruntime\n",
557602
" from azureml.automl.core.onnx_convert import OnnxInferenceHelper \n",
558-
" onnxrt_present = True\n",
603+
" from onnxruntime import __version__ as ORT_VER\n",
604+
" if ORT_VER == '0.4.0':\n",
605+
" onnxrt_present = True\n",
559606
"except ImportError:\n",
560607
" onnxrt_present = False\n",
608+
" \n",
609+
"# Install the onnxruntime if the version 0.4.0 is not installed.\n",
610+
"if not onnxrt_present:\n",
611+
" print(\"Installing the onnxruntime version 0.4.0.\")\n",
612+
" !{sys.executable} -m pip install --user --force-reinstall onnxruntime==0.4.0\n",
613+
" onnxrt_present = True\n",
561614
"\n",
562615
"def get_onnx_res(run):\n",
563616
" res_path = 'onnx_resource.json'\n",
@@ -826,13 +879,6 @@
826879
"\n",
827880
"[Moro et al., 2014] S. Moro, P. Cortez and P. Rita. A Data-Driven Approach to Predict the Success of Bank Telemarketing. Decision Support Systems, Elsevier, 62:22-31, June 2014"
828881
]
829-
},
830-
{
831-
"cell_type": "code",
832-
"execution_count": null,
833-
"metadata": {},
834-
"outputs": [],
835-
"source": []
836882
}
837883
],
838884
"metadata": {

how-to-use-azureml/automated-machine-learning/classification-bank-marketing-all-features/auto-ml-classification-bank-marketing-all-features.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ dependencies:
88
- azureml-widgets
99
- matplotlib
1010
- pandas_ml
11-
- onnxruntime
11+
- onnxruntime==0.4.0
1212
- azureml-explain-model
1313
- azureml-contrib-interpret

0 commit comments

Comments
 (0)