Skip to content

Commit a47e50b

Browse files
committed
update samples from Release-102 as a part of SDK release
1 parent 8f89d88 commit a47e50b

File tree

44 files changed

+605
-793
lines changed

Some content is hidden

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

44 files changed

+605
-793
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.29.0 of the Azure ML SDK\")\n",
106+
"print(\"This notebook was created using version 1.30.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: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@
4646
"Please see the [configuration notebook](../../configuration.ipynb) for information about creating one, if required.\n",
4747
"This notebook also requires the following packages:\n",
4848
"* `azureml-contrib-fairness`\n",
49-
"* `fairlearn==0.4.6` (v0.5.0 will work with minor modifications)\n",
49+
"* `fairlearn>=0.6.2` (pre-v0.5.0 will work with minor modifications)\n",
5050
"* `joblib`\n",
5151
"* `liac-arff`\n",
52+
"* `raiwidgets==0.4.0`\n",
5253
"\n",
5354
"Fairlearn relies on features introduced in v0.22.1 of `scikit-learn`. If you have an older version already installed, please uncomment and run the following cell:"
5455
]
@@ -85,7 +86,7 @@
8586
"outputs": [],
8687
"source": [
8788
"from fairlearn.reductions import GridSearch, DemographicParity, ErrorRate\n",
88-
"from fairlearn.widget import FairlearnDashboard\n",
89+
"from raiwidgets import FairnessDashboard\n",
8990
"\n",
9091
"from sklearn.compose import ColumnTransformer\n",
9192
"from sklearn.impute import SimpleImputer\n",
@@ -256,9 +257,9 @@
256257
"metadata": {},
257258
"outputs": [],
258259
"source": [
259-
"FairlearnDashboard(sensitive_features=A_test, sensitive_feature_names=['Sex', 'Race'],\n",
260-
" y_true=y_test,\n",
261-
" y_pred={\"unmitigated\": unmitigated_predictor.predict(X_test)})"
260+
"FairnessDashboard(sensitive_features=A_test,\n",
261+
" y_true=y_test,\n",
262+
" y_pred={\"unmitigated\": unmitigated_predictor.predict(X_test)})"
262263
]
263264
},
264265
{
@@ -311,8 +312,8 @@
311312
"sweep.fit(X_train, y_train,\n",
312313
" sensitive_features=A_train.sex)\n",
313314
"\n",
314-
"# For Fairlearn v0.5.0, need sweep.predictors_\n",
315-
"predictors = sweep._predictors"
315+
"# For Fairlearn pre-v0.5.0, need sweep._predictors\n",
316+
"predictors = sweep.predictors_"
316317
]
317318
},
318319
{
@@ -329,16 +330,14 @@
329330
"outputs": [],
330331
"source": [
331332
"errors, disparities = [], []\n",
332-
"for m in predictors:\n",
333-
" classifier = lambda X: m.predict(X)\n",
334-
" \n",
333+
"for predictor in predictors:\n",
335334
" error = ErrorRate()\n",
336335
" error.load_data(X_train, pd.Series(y_train), sensitive_features=A_train.sex)\n",
337336
" disparity = DemographicParity()\n",
338337
" disparity.load_data(X_train, pd.Series(y_train), sensitive_features=A_train.sex)\n",
339338
" \n",
340-
" errors.append(error.gamma(classifier)[0])\n",
341-
" disparities.append(disparity.gamma(classifier).max())\n",
339+
" errors.append(error.gamma(predictor.predict)[0])\n",
340+
" disparities.append(disparity.gamma(predictor.predict).max())\n",
342341
" \n",
343342
"all_results = pd.DataFrame( {\"predictor\": predictors, \"error\": errors, \"disparity\": disparities})\n",
344343
"\n",
@@ -387,10 +386,9 @@
387386
"metadata": {},
388387
"outputs": [],
389388
"source": [
390-
"FairlearnDashboard(sensitive_features=A_test, \n",
391-
" sensitive_feature_names=['Sex', 'Race'],\n",
392-
" y_true=y_test.tolist(),\n",
393-
" y_pred=predictions_dominant)"
389+
"FairnessDashboard(sensitive_features=A_test, \n",
390+
" y_true=y_test.tolist(),\n",
391+
" y_pred=predictions_dominant)"
394392
]
395393
},
396394
{
@@ -409,7 +407,7 @@
409407
"<a id=\"AzureUpload\"></a>\n",
410408
"## Uploading a Fairness Dashboard to Azure\n",
411409
"\n",
412-
"Uploading a fairness dashboard to Azure is a two stage process. The `FairlearnDashboard` invoked in the previous section relies on the underlying Python kernel to compute metrics on demand. This is obviously not available when the fairness dashboard is rendered in AzureML Studio. By default, the dashboard in Azure Machine Learning Studio also requires the models to be registered. The required stages are therefore:\n",
410+
"Uploading a fairness dashboard to Azure is a two stage process. The `FairnessDashboard` invoked in the previous section relies on the underlying Python kernel to compute metrics on demand. This is obviously not available when the fairness dashboard is rendered in AzureML Studio. By default, the dashboard in Azure Machine Learning Studio also requires the models to be registered. The required stages are therefore:\n",
413411
"1. Register the dominant models\n",
414412
"1. Precompute all the required metrics\n",
415413
"1. Upload to Azure\n",

contrib/fairness/fairlearn-azureml-mitigation.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ dependencies:
33
- pip:
44
- azureml-sdk
55
- azureml-contrib-fairness
6-
- fairlearn==0.4.6
6+
- fairlearn>=0.6.2
77
- joblib
88
- liac-arff
9+
- raiwidgets==0.4.0

contrib/fairness/upload-fairness-dashboard.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"1. [Training Models](#TrainingModels)\n",
3131
"1. [Logging in to AzureML](#LoginAzureML)\n",
3232
"1. [Registering the Models](#RegisterModels)\n",
33-
"1. [Using the Fairlearn Dashboard](#LocalDashboard)\n",
33+
"1. [Using the Fairness Dashboard](#LocalDashboard)\n",
3434
"1. [Uploading a Fairness Dashboard to Azure](#AzureUpload)\n",
3535
" 1. Computing Fairness Metrics\n",
3636
" 1. Uploading to Azure\n",
@@ -48,9 +48,10 @@
4848
"Please see the [configuration notebook](../../configuration.ipynb) for information about creating one, if required.\n",
4949
"This notebook also requires the following packages:\n",
5050
"* `azureml-contrib-fairness`\n",
51-
"* `fairlearn==0.4.6` (should also work with v0.5.0)\n",
51+
"* `fairlearn>=0.6.2` (also works for pre-v0.5.0 with slight modifications)\n",
5252
"* `joblib`\n",
5353
"* `liac-arff`\n",
54+
"* `raiwidgets==0.4.0`\n",
5455
"\n",
5556
"Fairlearn relies on features introduced in v0.22.1 of `scikit-learn`. If you have an older version already installed, please uncomment and run the following cell:"
5657
]
@@ -388,12 +389,11 @@
388389
"metadata": {},
389390
"outputs": [],
390391
"source": [
391-
"from fairlearn.widget import FairlearnDashboard\n",
392+
"from raiwidgets import FairnessDashboard\n",
392393
"\n",
393-
"FairlearnDashboard(sensitive_features=A_test, \n",
394-
" sensitive_feature_names=['Sex', 'Race'],\n",
395-
" y_true=y_test.tolist(),\n",
396-
" y_pred=ys_pred)"
394+
"FairnessDashboard(sensitive_features=A_test, \n",
395+
" y_true=y_test.tolist(),\n",
396+
" y_pred=ys_pred)"
397397
]
398398
},
399399
{
@@ -403,7 +403,7 @@
403403
"<a id=\"AzureUpload\"></a>\n",
404404
"## Uploading a Fairness Dashboard to Azure\n",
405405
"\n",
406-
"Uploading a fairness dashboard to Azure is a two stage process. The `FairlearnDashboard` invoked in the previous section relies on the underlying Python kernel to compute metrics on demand. This is obviously not available when the fairness dashboard is rendered in AzureML Studio. The required stages are therefore:\n",
406+
"Uploading a fairness dashboard to Azure is a two stage process. The `FairnessDashboard` invoked in the previous section relies on the underlying Python kernel to compute metrics on demand. This is obviously not available when the fairness dashboard is rendered in AzureML Studio. The required stages are therefore:\n",
407407
"1. Precompute all the required metrics\n",
408408
"1. Upload to Azure\n",
409409
"\n",

contrib/fairness/upload-fairness-dashboard.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ dependencies:
33
- pip:
44
- azureml-sdk
55
- azureml-contrib-fairness
6-
- fairlearn==0.4.6
6+
- fairlearn>=0.6.2
77
- joblib
88
- liac-arff
9+
- raiwidgets==0.4.0

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ dependencies:
2121

2222
- pip:
2323
# Required packages for AzureML execution, history, and data preparation.
24-
- azureml-widgets~=1.29.0
24+
- azureml-widgets~=1.30.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://automlresources-prod.azureedge.net/validated-requirements/1.29.0/validated_win32_requirements.txt [--no-deps]
28+
- -r https://automlresources-prod.azureedge.net/validated-requirements/1.30.0/validated_win32_requirements.txt [--no-deps]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ dependencies:
2121

2222
- pip:
2323
# Required packages for AzureML execution, history, and data preparation.
24-
- azureml-widgets~=1.29.0
24+
- azureml-widgets~=1.30.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://automlresources-prod.azureedge.net/validated-requirements/1.29.0/validated_linux_requirements.txt [--no-deps]
28+
- -r https://automlresources-prod.azureedge.net/validated-requirements/1.30.0/validated_linux_requirements.txt [--no-deps]

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

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

2323
- pip:
2424
# Required packages for AzureML execution, history, and data preparation.
25-
- azureml-widgets~=1.29.0
25+
- azureml-widgets~=1.30.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://automlresources-prod.azureedge.net/validated-requirements/1.29.0/validated_darwin_requirements.txt [--no-deps]
29+
- -r https://automlresources-prod.azureedge.net/validated-requirements/1.30.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.29.0 of the Azure ML SDK\")\n",
108+
"print(\"This notebook was created using version 1.30.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.29.0 of the Azure ML SDK\")\n",
96+
"print(\"This notebook was created using version 1.30.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)