Skip to content

Commit a79f8c2

Browse files
authored
Merge pull request Azure#1255 from Azure/release_update/Release-79
update samples from Release-79 as a part of SDK release
2 parents 41366a4 + fb4f287 commit a79f8c2

File tree

39 files changed

+372
-280
lines changed

39 files changed

+372
-280
lines changed

NBSETUP.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ git clone https://github.com/Azure/MachineLearningNotebooks.git
2828
pip install azureml-sdk[notebooks,tensorboard]
2929

3030
# install model explainability component
31-
pip install azureml-sdk[explain]
31+
pip install azureml-sdk[interpret]
3232

3333
# install automated ml components
3434
pip install azureml-sdk[automl]
@@ -86,7 +86,7 @@ If you need additional Azure ML SDK components, you can either modify the Docker
8686
pip install azureml-sdk[automl]
8787

8888
# install the core SDK and model explainability component
89-
pip install azureml-sdk[explain]
89+
pip install azureml-sdk[interpret]
9090

9191
# install the core SDK and experimental components
9292
pip install azureml-sdk[contrib]

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.18.0 of the Azure ML SDK\")\n",
106+
"print(\"This notebook was created using version 1.19.0 of the Azure ML SDK\")\n",
107107
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
108108
]
109109
},

contrib/fairness/fairlearn-azureml-mitigation.ipynb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"## Introduction\n",
3939
"This notebook shows how to use [Fairlearn (an open source fairness assessment and unfairness mitigation package)](http://fairlearn.github.io) and Azure Machine Learning Studio for a binary classification problem. This example uses the well-known adult census dataset. For the purposes of this notebook, we shall treat this as a loan decision problem. We will pretend that the label indicates whether or not each individual repaid a loan in the past. We will use the data to train a predictor to predict whether previously unseen individuals will repay a loan or not. The assumption is that the model predictions are used to decide whether an individual should be offered a loan. Its purpose is purely illustrative of a workflow including a fairness dashboard - in particular, we do **not** include a full discussion of the detailed issues which arise when considering fairness in machine learning. For such discussions, please [refer to the Fairlearn website](http://fairlearn.github.io/).\n",
4040
"\n",
41-
"We will apply the [grid search algorithm](https://fairlearn.github.io/api_reference/fairlearn.reductions.html#fairlearn.reductions.GridSearch) from the Fairlearn package using a specific notion of fairness called Demographic Parity. This produces a set of models, and we will view these in a dashboard both locally and in the Azure Machine Learning Studio.\n",
41+
"We will apply the [grid search algorithm](https://fairlearn.github.io/master/api_reference/fairlearn.reductions.html#fairlearn.reductions.GridSearch) from the Fairlearn package using a specific notion of fairness called Demographic Parity. This produces a set of models, and we will view these in a dashboard both locally and in the Azure Machine Learning Studio.\n",
4242
"\n",
4343
"### Setup\n",
4444
"\n",
@@ -98,8 +98,11 @@
9898
"metadata": {},
9999
"outputs": [],
100100
"source": [
101-
"from sklearn.datasets import fetch_openml\n",
102-
"data = fetch_openml(data_id=1590, as_frame=True)\n",
101+
"from utilities import fetch_openml_with_retries\n",
102+
"\n",
103+
"data = fetch_openml_with_retries(data_id=1590)\n",
104+
" \n",
105+
"# Extract the items we want\n",
103106
"X_raw = data.data\n",
104107
"Y = (data.target == '>50K') * 1\n",
105108
"\n",

contrib/fairness/upload-fairness-dashboard.ipynb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,11 @@
9898
"metadata": {},
9999
"outputs": [],
100100
"source": [
101-
"from sklearn.datasets import fetch_openml\n",
102-
"data = fetch_openml(data_id=1590, as_frame=True)\n",
101+
"from utilities import fetch_openml_with_retries\n",
102+
"\n",
103+
"data = fetch_openml_with_retries(data_id=1590)\n",
104+
" \n",
105+
"# Extract the items we want\n",
103106
"X_raw = data.data\n",
104107
"Y = (data.target == '>50K') * 1"
105108
]

contrib/fairness/utilities.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# ---------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# ---------------------------------------------------------
4+
5+
"""Utilities for azureml-contrib-fairness notebooks."""
6+
7+
from sklearn.datasets import fetch_openml
8+
import time
9+
10+
11+
def fetch_openml_with_retries(data_id, max_retries=4, retry_delay=60):
12+
"""Fetch a given dataset from OpenML with retries as specified."""
13+
for i in range(max_retries):
14+
try:
15+
print("Download attempt {0} of {1}".format(i + 1, max_retries))
16+
data = fetch_openml(data_id=data_id, as_frame=True)
17+
break
18+
except Exception as e:
19+
print("Download attempt failed with exception:")
20+
print(e)
21+
if i + 1 != max_retries:
22+
print("Will retry after {0} seconds".format(retry_delay))
23+
time.sleep(retry_delay)
24+
retry_delay = retry_delay * 2
25+
else:
26+
raise RuntimeError("Unable to download dataset from OpenML")
27+
28+
return data

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ dependencies:
33
# The python interpreter version.
44
# Currently Azure ML only supports 3.5.2 and later.
55
- pip<=19.3.1
6-
- python>=3.5.2,<3.6.8
6+
- python>=3.5.2,<3.8
77
- nb_conda
88
- boto3==1.15.18
99
- matplotlib==2.1.0
@@ -21,8 +21,8 @@ dependencies:
2121

2222
- pip:
2323
# Required packages for AzureML execution, history, and data preparation.
24-
- azureml-widgets~=1.18.0
24+
- azureml-widgets~=1.19.0
2525
- pytorch-transformers==1.0.0
2626
- spacy==2.1.8
2727
- https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz
28-
- -r https://automlcesdkdataresources.blob.core.windows.net/validated-requirements/1.18.0/validated_win32_requirements.txt [--no-deps]
28+
- -r https://automlcesdkdataresources.blob.core.windows.net/validated-requirements/1.19.0/validated_win32_requirements.txt [--no-deps]

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ dependencies:
33
# The python interpreter version.
44
# Currently Azure ML only supports 3.5.2 and later.
55
- pip<=19.3.1
6-
- python>=3.5.2,<3.6.8
6+
- python>=3.5.2,<3.8
77
- nb_conda
88
- boto3==1.15.18
99
- matplotlib==2.1.0
@@ -21,9 +21,9 @@ dependencies:
2121

2222
- pip:
2323
# Required packages for AzureML execution, history, and data preparation.
24-
- azureml-widgets~=1.18.0
24+
- azureml-widgets~=1.19.0
2525
- pytorch-transformers==1.0.0
2626
- spacy==2.1.8
2727
- https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz
28-
- -r https://automlcesdkdataresources.blob.core.windows.net/validated-requirements/1.18.0/validated_linux_requirements.txt [--no-deps]
28+
- -r https://automlcesdkdataresources.blob.core.windows.net/validated-requirements/1.19.0/validated_linux_requirements.txt [--no-deps]
2929

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ dependencies:
44
# Currently Azure ML only supports 3.5.2 and later.
55
- pip<=19.3.1
66
- nomkl
7-
- python>=3.5.2,<3.6.8
7+
- python>=3.5.2,<3.8
88
- nb_conda
99
- boto3==1.15.18
1010
- matplotlib==2.1.0
@@ -22,8 +22,8 @@ dependencies:
2222

2323
- pip:
2424
# Required packages for AzureML execution, history, and data preparation.
25-
- azureml-widgets~=1.18.0
25+
- azureml-widgets~=1.19.0
2626
- pytorch-transformers==1.0.0
2727
- spacy==2.1.8
2828
- https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz
29-
- -r https://automlcesdkdataresources.blob.core.windows.net/validated-requirements/1.18.0/validated_darwin_requirements.txt [--no-deps]
29+
- -r https://automlcesdkdataresources.blob.core.windows.net/validated-requirements/1.19.0/validated_darwin_requirements.txt [--no-deps]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"metadata": {},
106106
"outputs": [],
107107
"source": [
108-
"print(\"This notebook was created using version 1.18.0 of the Azure ML SDK\")\n",
108+
"print(\"This notebook was created using version 1.19.0 of the Azure ML SDK\")\n",
109109
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
110110
]
111111
},

how-to-use-azureml/automated-machine-learning/classification-credit-card-fraud/auto-ml-classification-credit-card-fraud.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"metadata": {},
9494
"outputs": [],
9595
"source": [
96-
"print(\"This notebook was created using version 1.18.0 of the Azure ML SDK\")\n",
96+
"print(\"This notebook was created using version 1.19.0 of the Azure ML SDK\")\n",
9797
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
9898
]
9999
},

0 commit comments

Comments
 (0)