Skip to content

Commit 3c9cb89

Browse files
harneetvirkvizhur
andauthored
update samples from Release-18 as a part of 1.1.0rc0 SDK experimental release (Azure#760)
Co-authored-by: vizhur <[email protected]>
1 parent cca7c2e commit 3c9cb89

File tree

42 files changed

+175
-2599
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+175
-2599
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This repository contains example notebooks demonstrating the [Azure Machine Learning](https://azure.microsoft.com/en-us/services/machine-learning-service/) Python SDK which allows you to build, train, deploy and manage machine learning solutions using Azure. The AML SDK allows you the choice of using local or cloud compute resources, while managing and maintaining the complete data science workflow from the cloud.
44

5-
![Azure ML Workflow](https://raw.githubusercontent.com/MicrosoftDocs/azure-docs/master/articles/machine-learning/service/media/concept-azure-machine-learning-architecture/workflow.png)
5+
![Azure ML Workflow](https://raw.githubusercontent.com/MicrosoftDocs/azure-docs/master/articles/machine-learning/media/concept-azure-machine-learning-architecture/workflow.png)
66

77

88
## Quick installation
@@ -17,7 +17,7 @@ This [index](.index.md) should assist in navigating the Azure Machine Learning n
1717

1818
If you want to...
1919

20-
* ...try out and explore Azure ML, start with image classification tutorials: [Part 1 (Training)](./tutorials/img-classification-part1-training.ipynb) and [Part 2 (Deployment)](./tutorials/img-classification-part2-deploy.ipynb).
20+
* ...try out and explore Azure ML, start with image classification tutorials: [Part 1 (Training)](./tutorials/image-classification-mnist-data/img-classification-part1-training.ipynb) and [Part 2 (Deployment)](./tutorials/image-classification-mnist-data/img-classification-part2-deploy.ipynb).
2121
* ...learn about experimentation and tracking run history, first [train within Notebook](./how-to-use-azureml/training/train-within-notebook/train-within-notebook.ipynb), then try [training on remote VM](./how-to-use-azureml/training/train-on-remote-vm/train-on-remote-vm.ipynb) and [using logging APIs](./how-to-use-azureml/training/logging-api/logging-api.ipynb).
2222
* ...train deep learning models at scale, first learn about [Machine Learning Compute](./how-to-use-azureml/training/train-on-amlcompute/train-on-amlcompute.ipynb), and then try [distributed hyperparameter tuning](./how-to-use-azureml/training-with-deep-learning/train-hyperparameter-tune-deploy-with-pytorch/train-hyperparameter-tune-deploy-with-pytorch.ipynb) and [distributed training](./how-to-use-azureml/training-with-deep-learning/distributed-pytorch-with-horovod/distributed-pytorch-with-horovod.ipynb).
2323
* ...deploy models as a realtime scoring service, first learn the basics by [training within Notebook and deploying to Azure Container Instance](./how-to-use-azureml/training/train-within-notebook/train-within-notebook.ipynb), then learn how to [production deploy models on Azure Kubernetes Cluster](./how-to-use-azureml/deployment/production-deploy-to-aks/production-deploy-to-aks.ipynb).

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.85 of the Azure ML SDK\")\n",
106+
"print(\"This notebook was created using version 1.1.0rc0 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/classification-credit-card-fraud/auto-ml-classification-credit-card-fraud.ipynb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,11 @@
282282
{
283283
"cell_type": "code",
284284
"execution_count": null,
285-
"metadata": {},
285+
"metadata": {
286+
"tags": [
287+
"widget-rundetails-sample"
288+
]
289+
},
286290
"outputs": [],
287291
"source": [
288292
"from azureml.widgets import RunDetails\n",

how-to-use-azureml/automated-machine-learning/forecasting-grouping/build.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
def _get_groups(data: Dataset, group_column_names: List[str]) -> pd.DataFrame:
1919
return data._dataflow.distinct(columns=group_column_names)\
20-
.keep_columns(columns=group_column_names).to_pandas_dataframe()
20+
.keep_columns(columns=group_column_names).to_pandas_dataframe()[group_column_names]
2121

2222

2323
def _get_configs(automlconfig: AutoMLConfig,
@@ -28,6 +28,9 @@ def _get_configs(automlconfig: AutoMLConfig,
2828
# remove invalid characters regex
2929
valid_chars = re.compile('[^a-zA-Z0-9-]')
3030
groups = _get_groups(data, group_column_names)
31+
if groups.shape[0] > 40:
32+
raise RuntimeError("AutoML only supports 40 or less groups. Please modify your "
33+
"group_column_names to ensure no more than 40 groups are present.")
3134
configs = {}
3235
for i, group in groups.iterrows():
3336
single = data._dataflow
@@ -118,7 +121,7 @@ def build_pipeline_steps(automlconfig: AutoMLConfig,
118121
# add deployment step
119122
pp_group_column_names = PipelineParameter(
120123
"group_column_names",
121-
default_value="#####".join(list(reversed(group_column_names))))
124+
default_value="#####".join(list(group_column_names)))
122125

123126
pp_model_names = PipelineParameter(
124127
"model_names",

how-to-use-azureml/automated-machine-learning/forecasting-grouping/deploy/myenv.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ dependencies:
66

77
- python=3.6.2
88
- numpy>=1.16.0,<=1.16.2
9+
- pandas>=0.21.0,<=0.23.4
910
- scikit-learn>=0.19.0,<=0.20.3
1011
- conda-forge::fbprophet==0.5
1112

how-to-use-azureml/automated-machine-learning/forecasting-grouping/deploy/score.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def run(raw_data):
3737
elif isinstance(grain, str):
3838
cur_group = grain
3939
else:
40-
cur_group = "#####".join(list(grain))
40+
cur_group = "#####".join([str(v) for v in list(grain)])
4141
cur_group = valid_chars.sub('', cur_group)
4242
print("Query model for group {}".format(cur_group))
4343
if cur_group not in models:

how-to-use-azureml/automated-machine-learning/regression-hardware-performance-explanation-and-featurization/auto-ml-regression-hardware-performance-explanation-and-featurization.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -717,10 +717,10 @@
717717
"metadata": {},
718718
"outputs": [],
719719
"source": [
720-
"myenv = automl_run.get_environment().python.conda_dependencies\n",
720+
"conda_dep = automl_run.get_environment().python.conda_dependencies\n",
721721
"\n",
722722
"with open(\"myenv.yml\",\"w\") as f:\n",
723-
" f.write(myenv.serialize_to_string())\n",
723+
" f.write(conda_dep.serialize_to_string())\n",
724724
"\n",
725725
"with open(\"myenv.yml\",\"r\") as f:\n",
726726
" print(f.read())"
@@ -761,16 +761,16 @@
761761
"from azureml.core.model import InferenceConfig\n",
762762
"from azureml.core.webservice import AciWebservice\n",
763763
"from azureml.core.model import Model\n",
764+
"from azureml.core.environment import Environment\n",
764765
"\n",
765766
"aciconfig = AciWebservice.deploy_configuration(cpu_cores=1, \n",
766767
" memory_gb=1, \n",
767768
" tags={\"data\": \"Machine Data\", \n",
768769
" \"method\" : \"local_explanation\"}, \n",
769770
" description='Get local explanations for Machine test data')\n",
770771
"\n",
771-
"inference_config = InferenceConfig(runtime= \"python\", \n",
772-
" entry_script=\"score_explain.py\",\n",
773-
" conda_file=\"myenv.yml\")\n",
772+
"myenv = Environment.from_conda_specification(name=\"myenv\", file_path=\"myenv.yml\")\n",
773+
"inference_config = InferenceConfig(entry_script=\"score_explain.py\", environment=myenv)\n",
774774
"\n",
775775
"# Use configs and models generated above\n",
776776
"service = Model.deploy(ws, 'model-scoring', [scoring_explainer_model, original_model], inference_config, aciconfig)\n",

how-to-use-azureml/explain-model/azure-integration/scoring-time/train-explain-model-on-amlcompute-and-deploy.ipynb

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -409,16 +409,6 @@
409409
" print(f.read())"
410410
]
411411
},
412-
{
413-
"cell_type": "code",
414-
"execution_count": null,
415-
"metadata": {},
416-
"outputs": [],
417-
"source": [
418-
"%%writefile dockerfile\n",
419-
"RUN apt-get update && apt-get install -y g++ "
420-
]
421-
},
422412
{
423413
"cell_type": "code",
424414
"execution_count": null,
@@ -439,17 +429,17 @@
439429
"from azureml.core.model import InferenceConfig\n",
440430
"from azureml.core.webservice import AciWebservice\n",
441431
"from azureml.core.model import Model\n",
432+
"from azureml.core.environment import Environment\n",
433+
"\n",
442434
"\n",
443435
"aciconfig = AciWebservice.deploy_configuration(cpu_cores=1, \n",
444436
" memory_gb=1, \n",
445437
" tags={\"data\": \"IBM_Attrition\", \n",
446438
" \"method\" : \"local_explanation\"}, \n",
447439
" description='Get local explanations for IBM Employee Attrition data')\n",
448440
"\n",
449-
"inference_config = InferenceConfig(runtime= \"python\", \n",
450-
" entry_script=\"score_remote_explain.py\",\n",
451-
" conda_file=\"myenv.yml\",\n",
452-
" extra_docker_file_steps=\"dockerfile\")\n",
441+
"myenv = Environment.from_conda_specification(name=\"myenv\", file_path=\"myenv.yml\")\n",
442+
"inference_config = InferenceConfig(entry_script=\"score_remote_explain.py\", environment=myenv)\n",
453443
"\n",
454444
"# Use configs and models generated above\n",
455445
"service = Model.deploy(ws, 'model-scoring-service', [scoring_explainer_model, original_model], inference_config, aciconfig)\n",

how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ These notebooks below are designed to go in sequence.
1818
13. [aml-pipelines-showcasing-datapath-and-pipelineparameter.ipynb](https://aka.ms/pl-datapath): This notebook showcases how to use DataPath and PipelineParameter in AML Pipeline.
1919
14. [aml-pipelines-how-to-use-pipeline-drafts.ipynb](http://aka.ms/pl-pl-draft): This notebook shows how to use Pipeline Drafts. Pipeline Drafts are mutable pipelines which can be used to submit runs and create Published Pipelines.
2020
15. [aml-pipelines-hot-to-use-modulestep.ipynb](https://aka.ms/pl-modulestep): This notebook shows how to define Module, ModuleVersion and how to use them in an AML Pipeline using ModuleStep.
21+
16. [aml-pipelines-with-notebook-runner-step.ipynb](https://aka.ms/pl-nbrstep): This notebook shows how you can run another notebook as a step in Azure Machine Learning Pipeline.
2122

2223
![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/README.png)

how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/aml-pipelines-with-notebook-runner-step.ipynb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@
7070
"from azureml.pipeline.core import PipelineData\n",
7171
"from azureml.core.datastore import Datastore\n",
7272
"\n",
73-
"from azureml.widgets import RunDetails\n",
74-
"\n",
7573
"from azureml.core import Workspace, Experiment\n",
7674
"from azureml.contrib.notebook import NotebookRunConfig, AzureMLNotebookHandler\n",
7775
"\n",
@@ -149,7 +147,7 @@
149147
"metadata": {},
150148
"source": [
151149
"### Create or Attach an AmlCompute cluster\n",
152-
"You will need to create a [compute target](https://docs.microsoft.com/azure/machine-learning/service/concept-azure-machine-learning-architecture#compute-target) for your AutoML run. In this tutorial, you get the default `AmlCompute` as your training compute resource."
150+
"You will need to create a [compute target](https://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.computetarget?view=azure-ml-py) for your remote run. In this tutorial, you get the default `AmlCompute` as your training compute resource."
153151
]
154152
},
155153
{
@@ -205,7 +203,7 @@
205203
"conda_run_config.environment.docker.enabled = True\n",
206204
"conda_run_config.environment.docker.base_image = azureml.core.runconfig.DEFAULT_CPU_IMAGE\n",
207205
"\n",
208-
"cd = CondaDependencies.create(pip_packages=['azureml-sdk'], pin_sdk_version=False)\n",
206+
"cd = CondaDependencies.create(pip_packages=['azureml-sdk'])\n",
209207
"conda_run_config.environment.python.conda_dependencies = cd\n",
210208
"\n",
211209
"print('run config is ready')"
@@ -298,7 +296,7 @@
298296
"metadata": {},
299297
"outputs": [],
300298
"source": [
301-
"from azureml.pipeline.core import PipelineParameter, TrainingOutput\n",
299+
"from azureml.pipeline.core import PipelineParameter\n",
302300
"\n",
303301
"output_from_notebook = PipelineData(name=\"notebook_processed_data\",\n",
304302
" datastore=Datastore.get(ws, \"workspaceblobstore\"))\n",
@@ -354,6 +352,7 @@
354352
"metadata": {},
355353
"outputs": [],
356354
"source": [
355+
"from azureml.widgets import RunDetails\n",
357356
"RunDetails(pipeline_run1).show()"
358357
]
359358
},

0 commit comments

Comments
 (0)