diff --git a/configuration.ipynb b/configuration.ipynb
index e2cefa2a..5fb17e42 100644
--- a/configuration.ipynb
+++ b/configuration.ipynb
@@ -103,7 +103,7 @@
"source": [
"import azureml.core\n",
"\n",
- "print(\"This notebook was created using version 1.26.0 of the Azure ML SDK\")\n",
+ "print(\"This notebook was created using version 1.27.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
diff --git a/contrib/fairness/fairlearn-azureml-mitigation.ipynb b/contrib/fairness/fairlearn-azureml-mitigation.ipynb
index cbe2d5da..8e1de72c 100644
--- a/contrib/fairness/fairlearn-azureml-mitigation.ipynb
+++ b/contrib/fairness/fairlearn-azureml-mitigation.ipynb
@@ -36,9 +36,9 @@
"\n",
"\n",
"## Introduction\n",
- "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",
+ "This notebook shows how to use [Fairlearn (an open source fairness assessment and unfairness mitigation package)](http://fairlearn.org) 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.org/).\n",
"\n",
- "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",
+ "We will apply the [grid search algorithm](https://fairlearn.org/v0.4.6/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",
"\n",
"### Setup\n",
"\n",
@@ -48,7 +48,7 @@
"* `azureml-contrib-fairness`\n",
"* `fairlearn==0.4.6` (v0.5.0 will work with minor modifications)\n",
"* `joblib`\n",
- "* `shap`\n",
+ "* `liac-arff`\n",
"\n",
"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:"
]
@@ -88,7 +88,6 @@
"from fairlearn.widget import FairlearnDashboard\n",
"\n",
"from sklearn.compose import ColumnTransformer\n",
- "from sklearn.datasets import fetch_openml\n",
"from sklearn.impute import SimpleImputer\n",
"from sklearn.linear_model import LogisticRegression\n",
"from sklearn.model_selection import train_test_split\n",
@@ -112,9 +111,9 @@
"metadata": {},
"outputs": [],
"source": [
- "from fairness_nb_utils import fetch_openml_with_retries\n",
+ "from fairness_nb_utils import fetch_census_dataset\n",
"\n",
- "data = fetch_openml_with_retries(data_id=1590)\n",
+ "data = fetch_census_dataset()\n",
" \n",
"# Extract the items we want\n",
"X_raw = data.data\n",
@@ -137,7 +136,7 @@
"outputs": [],
"source": [
"A = X_raw[['sex','race']]\n",
- "X_raw = X_raw.drop(labels=['sex', 'race'],axis = 1)"
+ "X_raw = X_raw.drop(labels=['sex', 'race'], axis = 1)"
]
},
{
@@ -584,7 +583,7 @@
"\n",
"## Conclusion\n",
"\n",
- "In this notebook we have demonstrated how to use the `GridSearch` algorithm from Fairlearn to generate a collection of models, and then present them in the fairness dashboard in Azure Machine Learning Studio. Please remember that this notebook has not attempted to discuss the many considerations which should be part of any approach to unfairness mitigation. The [Fairlearn website](http://fairlearn.github.io/) provides that discussion"
+ "In this notebook we have demonstrated how to use the `GridSearch` algorithm from Fairlearn to generate a collection of models, and then present them in the fairness dashboard in Azure Machine Learning Studio. Please remember that this notebook has not attempted to discuss the many considerations which should be part of any approach to unfairness mitigation. The [Fairlearn website](http://fairlearn.org/) provides that discussion"
]
},
{
diff --git a/contrib/fairness/fairlearn-azureml-mitigation.yml b/contrib/fairness/fairlearn-azureml-mitigation.yml
index a9b11777..384ad5d9 100644
--- a/contrib/fairness/fairlearn-azureml-mitigation.yml
+++ b/contrib/fairness/fairlearn-azureml-mitigation.yml
@@ -5,3 +5,4 @@ dependencies:
- azureml-contrib-fairness
- fairlearn==0.4.6
- joblib
+ - liac-arff
diff --git a/contrib/fairness/fairness_nb_utils.py b/contrib/fairness/fairness_nb_utils.py
index 337aadff..69e74f07 100644
--- a/contrib/fairness/fairness_nb_utils.py
+++ b/contrib/fairness/fairness_nb_utils.py
@@ -4,7 +4,13 @@
"""Utilities for azureml-contrib-fairness notebooks."""
+import arff
+from collections import OrderedDict
+from contextlib import closing
+import gzip
+import pandas as pd
from sklearn.datasets import fetch_openml
+from sklearn.utils import Bunch
import time
@@ -26,3 +32,62 @@ def fetch_openml_with_retries(data_id, max_retries=4, retry_delay=60):
raise RuntimeError("Unable to download dataset from OpenML")
return data
+
+
+_categorical_columns = [
+ 'workclass',
+ 'education',
+ 'marital-status',
+ 'occupation',
+ 'relationship',
+ 'race',
+ 'sex',
+ 'native-country'
+]
+
+
+def fetch_census_dataset():
+ """Fetch the Adult Census Dataset
+
+ This uses a particular URL for the Adult Census dataset. The code
+ is a simplified version of fetch_openml() in sklearn.
+
+ The data are copied from:
+ https://openml.org/data/v1/download/1595261.gz
+ (as of 2021-03-31)
+ """
+ try:
+ from urllib import urlretrieve
+ except ImportError:
+ from urllib.request import urlretrieve
+
+ filename = "1595261.gz"
+ data_url = "https://rainotebookscdn.blob.core.windows.net/datasets/"
+ urlretrieve(data_url + filename, filename)
+
+ http_stream = gzip.GzipFile(filename=filename, mode='rb')
+
+ with closing(http_stream):
+ def _stream_generator(response):
+ for line in response:
+ yield line.decode('utf-8')
+
+ stream = _stream_generator(http_stream)
+ data = arff.load(stream)
+
+ attributes = OrderedDict(data['attributes'])
+ arff_columns = list(attributes)
+
+ raw_df = pd.DataFrame(data=data['data'], columns=arff_columns)
+
+ target_column_name = 'class'
+ target = raw_df.pop(target_column_name)
+ for col_name in _categorical_columns:
+ dtype = pd.api.types.CategoricalDtype(attributes[col_name])
+ raw_df[col_name] = raw_df[col_name].astype(dtype, copy=False)
+
+ result = Bunch()
+ result.data = raw_df
+ result.target = target
+
+ return result
diff --git a/contrib/fairness/upload-fairness-dashboard.ipynb b/contrib/fairness/upload-fairness-dashboard.ipynb
index d41b4bb0..8880f3c9 100644
--- a/contrib/fairness/upload-fairness-dashboard.ipynb
+++ b/contrib/fairness/upload-fairness-dashboard.ipynb
@@ -50,7 +50,7 @@
"* `azureml-contrib-fairness`\n",
"* `fairlearn==0.4.6` (should also work with v0.5.0)\n",
"* `joblib`\n",
- "* `shap`\n",
+ "* `liac-arff`\n",
"\n",
"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:"
]
@@ -88,7 +88,6 @@
"source": [
"from sklearn import svm\n",
"from sklearn.compose import ColumnTransformer\n",
- "from sklearn.datasets import fetch_openml\n",
"from sklearn.impute import SimpleImputer\n",
"from sklearn.linear_model import LogisticRegression\n",
"from sklearn.model_selection import train_test_split\n",
@@ -110,9 +109,9 @@
"metadata": {},
"outputs": [],
"source": [
- "from fairness_nb_utils import fetch_openml_with_retries\n",
+ "from fairness_nb_utils import fetch_census_dataset\n",
"\n",
- "data = fetch_openml_with_retries(data_id=1590)\n",
+ "data = fetch_census_dataset()\n",
" \n",
"# Extract the items we want\n",
"X_raw = data.data\n",
diff --git a/contrib/fairness/upload-fairness-dashboard.yml b/contrib/fairness/upload-fairness-dashboard.yml
index 71cae4c3..196296e4 100644
--- a/contrib/fairness/upload-fairness-dashboard.yml
+++ b/contrib/fairness/upload-fairness-dashboard.yml
@@ -5,3 +5,4 @@ dependencies:
- azureml-contrib-fairness
- fairlearn==0.4.6
- joblib
+ - liac-arff
diff --git a/how-to-use-azureml/automated-machine-learning/automl_env.yml b/how-to-use-azureml/automated-machine-learning/automl_env.yml
index 7e62803a..b0dfac07 100644
--- a/how-to-use-azureml/automated-machine-learning/automl_env.yml
+++ b/how-to-use-azureml/automated-machine-learning/automl_env.yml
@@ -21,8 +21,8 @@ dependencies:
- pip:
# Required packages for AzureML execution, history, and data preparation.
- - azureml-widgets~=1.26.0
+ - azureml-widgets~=1.27.0
- pytorch-transformers==1.0.0
- spacy==2.1.8
- https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz
- - -r https://automlcesdkdataresources.blob.core.windows.net/validated-requirements/1.26.0/validated_win32_requirements.txt [--no-deps]
+ - -r https://automlcesdkdataresources.blob.core.windows.net/validated-requirements/1.27.0/validated_win32_requirements.txt [--no-deps]
diff --git a/how-to-use-azureml/automated-machine-learning/automl_env_linux.yml b/how-to-use-azureml/automated-machine-learning/automl_env_linux.yml
index d4f3c553..61aec3da 100644
--- a/how-to-use-azureml/automated-machine-learning/automl_env_linux.yml
+++ b/how-to-use-azureml/automated-machine-learning/automl_env_linux.yml
@@ -21,8 +21,8 @@ dependencies:
- pip:
# Required packages for AzureML execution, history, and data preparation.
- - azureml-widgets~=1.26.0
+ - azureml-widgets~=1.27.0
- pytorch-transformers==1.0.0
- spacy==2.1.8
- https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz
- - -r https://automlcesdkdataresources.blob.core.windows.net/validated-requirements/1.26.0/validated_linux_requirements.txt [--no-deps]
+ - -r https://automlcesdkdataresources.blob.core.windows.net/validated-requirements/1.27.0/validated_linux_requirements.txt [--no-deps]
diff --git a/how-to-use-azureml/automated-machine-learning/automl_env_mac.yml b/how-to-use-azureml/automated-machine-learning/automl_env_mac.yml
index 9d277028..8a7d2030 100644
--- a/how-to-use-azureml/automated-machine-learning/automl_env_mac.yml
+++ b/how-to-use-azureml/automated-machine-learning/automl_env_mac.yml
@@ -22,8 +22,8 @@ dependencies:
- pip:
# Required packages for AzureML execution, history, and data preparation.
- - azureml-widgets~=1.26.0
+ - azureml-widgets~=1.27.0
- pytorch-transformers==1.0.0
- spacy==2.1.8
- https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz
- - -r https://automlcesdkdataresources.blob.core.windows.net/validated-requirements/1.26.0/validated_darwin_requirements.txt [--no-deps]
+ - -r https://automlcesdkdataresources.blob.core.windows.net/validated-requirements/1.27.0/validated_darwin_requirements.txt [--no-deps]
diff --git a/how-to-use-azureml/automated-machine-learning/classification-bank-marketing-all-features/auto-ml-classification-bank-marketing-all-features.ipynb b/how-to-use-azureml/automated-machine-learning/classification-bank-marketing-all-features/auto-ml-classification-bank-marketing-all-features.ipynb
index 870352c0..9f0072ea 100644
--- a/how-to-use-azureml/automated-machine-learning/classification-bank-marketing-all-features/auto-ml-classification-bank-marketing-all-features.ipynb
+++ b/how-to-use-azureml/automated-machine-learning/classification-bank-marketing-all-features/auto-ml-classification-bank-marketing-all-features.ipynb
@@ -105,7 +105,7 @@
"metadata": {},
"outputs": [],
"source": [
- "print(\"This notebook was created using version 1.26.0 of the Azure ML SDK\")\n",
+ "print(\"This notebook was created using version 1.27.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
diff --git a/how-to-use-azureml/automated-machine-learning/classification-credit-card-fraud/auto-ml-classification-credit-card-fraud.ipynb b/how-to-use-azureml/automated-machine-learning/classification-credit-card-fraud/auto-ml-classification-credit-card-fraud.ipynb
index 03701b12..8a0a8055 100644
--- a/how-to-use-azureml/automated-machine-learning/classification-credit-card-fraud/auto-ml-classification-credit-card-fraud.ipynb
+++ b/how-to-use-azureml/automated-machine-learning/classification-credit-card-fraud/auto-ml-classification-credit-card-fraud.ipynb
@@ -93,7 +93,7 @@
"metadata": {},
"outputs": [],
"source": [
- "print(\"This notebook was created using version 1.26.0 of the Azure ML SDK\")\n",
+ "print(\"This notebook was created using version 1.27.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
diff --git a/how-to-use-azureml/automated-machine-learning/classification-text-dnn/auto-ml-classification-text-dnn.ipynb b/how-to-use-azureml/automated-machine-learning/classification-text-dnn/auto-ml-classification-text-dnn.ipynb
index ed7c222e..325335f6 100644
--- a/how-to-use-azureml/automated-machine-learning/classification-text-dnn/auto-ml-classification-text-dnn.ipynb
+++ b/how-to-use-azureml/automated-machine-learning/classification-text-dnn/auto-ml-classification-text-dnn.ipynb
@@ -96,7 +96,7 @@
"metadata": {},
"outputs": [],
"source": [
- "print(\"This notebook was created using version 1.26.0 of the Azure ML SDK\")\n",
+ "print(\"This notebook was created using version 1.27.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
@@ -281,7 +281,7 @@
"outputs": [],
"source": [
"automl_settings = {\n",
- " \"experiment_timeout_minutes\": 20,\n",
+ " \"experiment_timeout_minutes\": 30,\n",
" \"primary_metric\": 'accuracy',\n",
" \"max_concurrent_iterations\": num_nodes, \n",
" \"max_cores_per_iteration\": -1,\n",
diff --git a/how-to-use-azureml/automated-machine-learning/continuous-retraining/auto-ml-continuous-retraining.ipynb b/how-to-use-azureml/automated-machine-learning/continuous-retraining/auto-ml-continuous-retraining.ipynb
index c6ca4a5c..c05de38e 100644
--- a/how-to-use-azureml/automated-machine-learning/continuous-retraining/auto-ml-continuous-retraining.ipynb
+++ b/how-to-use-azureml/automated-machine-learning/continuous-retraining/auto-ml-continuous-retraining.ipynb
@@ -81,7 +81,7 @@
"metadata": {},
"outputs": [],
"source": [
- "print(\"This notebook was created using version 1.26.0 of the Azure ML SDK\")\n",
+ "print(\"This notebook was created using version 1.27.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
diff --git a/how-to-use-azureml/automated-machine-learning/experimental/regression-model-proxy/auto-ml-regression-model-proxy.ipynb b/how-to-use-azureml/automated-machine-learning/experimental/regression-model-proxy/auto-ml-regression-model-proxy.ipynb
index efc2674b..52e23431 100644
--- a/how-to-use-azureml/automated-machine-learning/experimental/regression-model-proxy/auto-ml-regression-model-proxy.ipynb
+++ b/how-to-use-azureml/automated-machine-learning/experimental/regression-model-proxy/auto-ml-regression-model-proxy.ipynb
@@ -91,7 +91,7 @@
"metadata": {},
"outputs": [],
"source": [
- "print(\"This notebook was created using version 1.26.0 of the Azure ML SDK\")\n",
+ "print(\"This notebook was created using version 1.27.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
diff --git a/how-to-use-azureml/automated-machine-learning/forecasting-beer-remote/auto-ml-forecasting-beer-remote.ipynb b/how-to-use-azureml/automated-machine-learning/forecasting-beer-remote/auto-ml-forecasting-beer-remote.ipynb
index 38514b45..5b674fe3 100644
--- a/how-to-use-azureml/automated-machine-learning/forecasting-beer-remote/auto-ml-forecasting-beer-remote.ipynb
+++ b/how-to-use-azureml/automated-machine-learning/forecasting-beer-remote/auto-ml-forecasting-beer-remote.ipynb
@@ -113,7 +113,7 @@
"metadata": {},
"outputs": [],
"source": [
- "print(\"This notebook was created using version 1.26.0 of the Azure ML SDK\")\n",
+ "print(\"This notebook was created using version 1.27.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
diff --git a/how-to-use-azureml/automated-machine-learning/forecasting-bike-share/auto-ml-forecasting-bike-share.ipynb b/how-to-use-azureml/automated-machine-learning/forecasting-bike-share/auto-ml-forecasting-bike-share.ipynb
index a1a42d90..0ad38eab 100644
--- a/how-to-use-azureml/automated-machine-learning/forecasting-bike-share/auto-ml-forecasting-bike-share.ipynb
+++ b/how-to-use-azureml/automated-machine-learning/forecasting-bike-share/auto-ml-forecasting-bike-share.ipynb
@@ -87,7 +87,7 @@
"metadata": {},
"outputs": [],
"source": [
- "print(\"This notebook was created using version 1.26.0 of the Azure ML SDK\")\n",
+ "print(\"This notebook was created using version 1.27.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
diff --git a/how-to-use-azureml/automated-machine-learning/forecasting-energy-demand/auto-ml-forecasting-energy-demand.ipynb b/how-to-use-azureml/automated-machine-learning/forecasting-energy-demand/auto-ml-forecasting-energy-demand.ipynb
index b78e6e4f..0b3899bb 100644
--- a/how-to-use-azureml/automated-machine-learning/forecasting-energy-demand/auto-ml-forecasting-energy-demand.ipynb
+++ b/how-to-use-azureml/automated-machine-learning/forecasting-energy-demand/auto-ml-forecasting-energy-demand.ipynb
@@ -97,7 +97,7 @@
"metadata": {},
"outputs": [],
"source": [
- "print(\"This notebook was created using version 1.26.0 of the Azure ML SDK\")\n",
+ "print(\"This notebook was created using version 1.27.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
diff --git a/how-to-use-azureml/automated-machine-learning/forecasting-forecast-function/auto-ml-forecasting-function.ipynb b/how-to-use-azureml/automated-machine-learning/forecasting-forecast-function/auto-ml-forecasting-function.ipynb
index 6942f0c5..c5f2b0cb 100644
--- a/how-to-use-azureml/automated-machine-learning/forecasting-forecast-function/auto-ml-forecasting-function.ipynb
+++ b/how-to-use-azureml/automated-machine-learning/forecasting-forecast-function/auto-ml-forecasting-function.ipynb
@@ -94,7 +94,7 @@
"metadata": {},
"outputs": [],
"source": [
- "print(\"This notebook was created using version 1.26.0 of the Azure ML SDK\")\n",
+ "print(\"This notebook was created using version 1.27.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
diff --git a/how-to-use-azureml/automated-machine-learning/forecasting-orange-juice-sales/auto-ml-forecasting-orange-juice-sales.ipynb b/how-to-use-azureml/automated-machine-learning/forecasting-orange-juice-sales/auto-ml-forecasting-orange-juice-sales.ipynb
index 1b9f31ec..db8eccfc 100644
--- a/how-to-use-azureml/automated-machine-learning/forecasting-orange-juice-sales/auto-ml-forecasting-orange-juice-sales.ipynb
+++ b/how-to-use-azureml/automated-machine-learning/forecasting-orange-juice-sales/auto-ml-forecasting-orange-juice-sales.ipynb
@@ -82,7 +82,7 @@
"metadata": {},
"outputs": [],
"source": [
- "print(\"This notebook was created using version 1.26.0 of the Azure ML SDK\")\n",
+ "print(\"This notebook was created using version 1.27.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
diff --git a/how-to-use-azureml/automated-machine-learning/local-run-classification-credit-card-fraud/auto-ml-classification-credit-card-fraud-local.ipynb b/how-to-use-azureml/automated-machine-learning/local-run-classification-credit-card-fraud/auto-ml-classification-credit-card-fraud-local.ipynb
index 0f18e264..d8393f0e 100644
--- a/how-to-use-azureml/automated-machine-learning/local-run-classification-credit-card-fraud/auto-ml-classification-credit-card-fraud-local.ipynb
+++ b/how-to-use-azureml/automated-machine-learning/local-run-classification-credit-card-fraud/auto-ml-classification-credit-card-fraud-local.ipynb
@@ -96,7 +96,7 @@
"metadata": {},
"outputs": [],
"source": [
- "print(\"This notebook was created using version 1.26.0 of the Azure ML SDK\")\n",
+ "print(\"This notebook was created using version 1.27.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
diff --git a/how-to-use-azureml/automated-machine-learning/regression-explanation-featurization/auto-ml-regression-explanation-featurization.ipynb b/how-to-use-azureml/automated-machine-learning/regression-explanation-featurization/auto-ml-regression-explanation-featurization.ipynb
index fea9e2f9..2e1cd266 100644
--- a/how-to-use-azureml/automated-machine-learning/regression-explanation-featurization/auto-ml-regression-explanation-featurization.ipynb
+++ b/how-to-use-azureml/automated-machine-learning/regression-explanation-featurization/auto-ml-regression-explanation-featurization.ipynb
@@ -96,7 +96,7 @@
"metadata": {},
"outputs": [],
"source": [
- "print(\"This notebook was created using version 1.26.0 of the Azure ML SDK\")\n",
+ "print(\"This notebook was created using version 1.27.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
@@ -439,7 +439,7 @@
"\n",
"### Retrieve any AutoML Model for explanations\n",
"\n",
- "Below we select the some AutoML pipeline from our iterations. The `get_output` method returns the a AutoML run and the fitted model for the last invocation. Overloads on `get_output` allow you to retrieve the best run and fitted model for *any* logged metric or for a particular *iteration*."
+ "Below we select an AutoML pipeline from our iterations. The `get_output` method returns the a AutoML run and the fitted model for the last invocation. Overloads on `get_output` allow you to retrieve the best run and fitted model for any logged `metric` or for a particular `iteration`."
]
},
{
@@ -448,7 +448,8 @@
"metadata": {},
"outputs": [],
"source": [
- "automl_run, fitted_model = remote_run.get_output(metric='r2_score')"
+ "#automl_run, fitted_model = remote_run.get_output(metric='r2_score')\n",
+ "automl_run, fitted_model = remote_run.get_output(iteration=2)"
]
},
{
diff --git a/how-to-use-azureml/automated-machine-learning/regression/auto-ml-regression.ipynb b/how-to-use-azureml/automated-machine-learning/regression/auto-ml-regression.ipynb
index 9ee62c9b..fedd7547 100644
--- a/how-to-use-azureml/automated-machine-learning/regression/auto-ml-regression.ipynb
+++ b/how-to-use-azureml/automated-machine-learning/regression/auto-ml-regression.ipynb
@@ -92,7 +92,7 @@
"metadata": {},
"outputs": [],
"source": [
- "print(\"This notebook was created using version 1.26.0 of the Azure ML SDK\")\n",
+ "print(\"This notebook was created using version 1.27.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
diff --git a/how-to-use-azureml/explain-model/azure-integration/scoring-time/train-explain-model-locally-and-deploy.ipynb b/how-to-use-azureml/explain-model/azure-integration/scoring-time/train-explain-model-locally-and-deploy.ipynb
index e78e4a87..cee7df82 100644
--- a/how-to-use-azureml/explain-model/azure-integration/scoring-time/train-explain-model-locally-and-deploy.ipynb
+++ b/how-to-use-azureml/explain-model/azure-integration/scoring-time/train-explain-model-locally-and-deploy.ipynb
@@ -388,6 +388,7 @@
"from azureml.core.webservice import AciWebservice\n",
"from azureml.core.model import Model\n",
"from azureml.core.environment import Environment\n",
+ "from azureml.exceptions import WebserviceException\n",
"\n",
"\n",
"aciconfig = AciWebservice.deploy_configuration(cpu_cores=1, \n",
diff --git a/how-to-use-azureml/explain-model/azure-integration/scoring-time/train-explain-model-on-amlcompute-and-deploy.ipynb b/how-to-use-azureml/explain-model/azure-integration/scoring-time/train-explain-model-on-amlcompute-and-deploy.ipynb
index 0881ebf9..e39afe4a 100644
--- a/how-to-use-azureml/explain-model/azure-integration/scoring-time/train-explain-model-on-amlcompute-and-deploy.ipynb
+++ b/how-to-use-azureml/explain-model/azure-integration/scoring-time/train-explain-model-on-amlcompute-and-deploy.ipynb
@@ -486,6 +486,7 @@
"from azureml.core.webservice import AciWebservice\n",
"from azureml.core.model import Model\n",
"from azureml.core.environment import Environment\n",
+ "from azureml.exceptions import WebserviceException\n",
"\n",
"\n",
"aciconfig = AciWebservice.deploy_configuration(cpu_cores=1, \n",
diff --git a/how-to-use-azureml/responsible-ai/visualize-upload-loan-decision/rai-loan-decision.ipynb b/how-to-use-azureml/responsible-ai/visualize-upload-loan-decision/rai-loan-decision.ipynb
index b008df60..223e4ef8 100644
--- a/how-to-use-azureml/responsible-ai/visualize-upload-loan-decision/rai-loan-decision.ipynb
+++ b/how-to-use-azureml/responsible-ai/visualize-upload-loan-decision/rai-loan-decision.ipynb
@@ -72,7 +72,6 @@
"from fairlearn.reductions import GridSearch\n",
"from fairlearn.reductions import DemographicParity, ErrorRate\n",
"\n",
- "from sklearn import svm, neighbors, tree\n",
"from sklearn.compose import ColumnTransformer, make_column_selector\n",
"from sklearn.preprocessing import LabelEncoder,StandardScaler\n",
"from sklearn.linear_model import LogisticRegression\n",
@@ -81,10 +80,8 @@
"from sklearn.preprocessing import StandardScaler, OneHotEncoder\n",
"from sklearn.svm import SVC\n",
"from sklearn.metrics import accuracy_score\n",
- "from sklearn.datasets import fetch_openml\n",
"\n",
"import pandas as pd\n",
- "import numpy as np\n",
"\n",
"# SHAP Tabular Explainer\n",
"from interpret.ext.blackbox import KernelExplainer\n",
@@ -105,7 +102,9 @@
"metadata": {},
"outputs": [],
"source": [
- "dataset = fetch_openml(data_id=1590, as_frame=True)\n",
+ "from utilities import fetch_census_dataset\n",
+ "\n",
+ "dataset = fetch_census_dataset()\n",
"X_raw, y = dataset['data'], dataset['target']\n",
"X_raw[\"race\"].value_counts().to_dict()"
]
diff --git a/how-to-use-azureml/responsible-ai/visualize-upload-loan-decision/rai-loan-decision.yml b/how-to-use-azureml/responsible-ai/visualize-upload-loan-decision/rai-loan-decision.yml
index 89a23710..d602f6b6 100644
--- a/how-to-use-azureml/responsible-ai/visualize-upload-loan-decision/rai-loan-decision.yml
+++ b/how-to-use-azureml/responsible-ai/visualize-upload-loan-decision/rai-loan-decision.yml
@@ -9,3 +9,4 @@ dependencies:
- azureml-dataset-runtime
- ipywidgets
- raiwidgets
+ - liac-arff
diff --git a/how-to-use-azureml/responsible-ai/visualize-upload-loan-decision/utilities.py b/how-to-use-azureml/responsible-ai/visualize-upload-loan-decision/utilities.py
new file mode 100644
index 00000000..c2d60e54
--- /dev/null
+++ b/how-to-use-azureml/responsible-ai/visualize-upload-loan-decision/utilities.py
@@ -0,0 +1,75 @@
+# ---------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# ---------------------------------------------------------
+
+"""Utilities for azureml-contrib-fairness notebooks."""
+
+import arff
+from collections import OrderedDict
+from contextlib import closing
+import gzip
+import pandas as pd
+from sklearn.utils import Bunch
+
+
+def _is_gzip_encoded(_fsrc):
+ return _fsrc.info().get('Content-Encoding', '') == 'gzip'
+
+
+_categorical_columns = [
+ 'workclass',
+ 'education',
+ 'marital-status',
+ 'occupation',
+ 'relationship',
+ 'race',
+ 'sex',
+ 'native-country'
+]
+
+
+def fetch_census_dataset():
+ """Fetch the Adult Census Dataset
+
+ This uses a particular URL for the Adult Census dataset. The code
+ is a simplified version of fetch_openml() in sklearn.
+
+ The data are copied from:
+ https://openml.org/data/v1/download/1595261.gz
+ (as of 2021-03-31)
+ """
+ try:
+ from urllib import urlretrieve
+ except ImportError:
+ from urllib.request import urlretrieve
+
+ filename = "1595261.gz"
+ data_url = "https://rainotebookscdn.blob.core.windows.net/datasets/"
+ urlretrieve(data_url + filename, filename)
+
+ http_stream = gzip.GzipFile(filename=filename, mode='rb')
+
+ with closing(http_stream):
+ def _stream_generator(response):
+ for line in response:
+ yield line.decode('utf-8')
+
+ stream = _stream_generator(http_stream)
+ data = arff.load(stream)
+
+ attributes = OrderedDict(data['attributes'])
+ arff_columns = list(attributes)
+
+ raw_df = pd.DataFrame(data=data['data'], columns=arff_columns)
+
+ target_column_name = 'class'
+ target = raw_df.pop(target_column_name)
+ for col_name in _categorical_columns:
+ dtype = pd.api.types.CategoricalDtype(attributes[col_name])
+ raw_df[col_name] = raw_df[col_name].astype(dtype, copy=False)
+
+ result = Bunch()
+ result.data = raw_df
+ result.target = target
+
+ return result
diff --git a/how-to-use-azureml/track-and-monitor-experiments/logging-api/logging-api.ipynb b/how-to-use-azureml/track-and-monitor-experiments/logging-api/logging-api.ipynb
index 3d9f93c7..e2fddfdc 100644
--- a/how-to-use-azureml/track-and-monitor-experiments/logging-api/logging-api.ipynb
+++ b/how-to-use-azureml/track-and-monitor-experiments/logging-api/logging-api.ipynb
@@ -100,7 +100,7 @@
"\n",
"# Check core SDK version number\n",
"\n",
- "print(\"This notebook was created using SDK version 1.26.0, you are currently running version\", azureml.core.VERSION)"
+ "print(\"This notebook was created using SDK version 1.27.0, you are currently running version\", azureml.core.VERSION)"
]
},
{
diff --git a/setup-environment/configuration.ipynb b/setup-environment/configuration.ipynb
index 90adaed4..305ec9ed 100644
--- a/setup-environment/configuration.ipynb
+++ b/setup-environment/configuration.ipynb
@@ -102,7 +102,7 @@
"source": [
"import azureml.core\n",
"\n",
- "print(\"This notebook was created using version 1.26.0 of the Azure ML SDK\")\n",
+ "print(\"This notebook was created using version 1.27.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},