mirror of
https://github.com/Azure/MachineLearningNotebooks.git
synced 2025-12-20 01:27:06 -05:00
Compare commits
26 Commits
azureml-sd
...
azureml-sd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68d6108ef6 | ||
|
|
40b3068462 | ||
|
|
0ecbbbce75 | ||
|
|
9b1e130d18 | ||
|
|
0e17b33d2a | ||
|
|
34d80abd26 | ||
|
|
249278ab77 | ||
|
|
25fdb17f80 | ||
|
|
3a02a27f1e | ||
|
|
4eed9d529f | ||
|
|
f344d410a2 | ||
|
|
9dc1228063 | ||
|
|
4404e62f58 | ||
|
|
38d5743bbb | ||
|
|
0814eee151 | ||
|
|
f45b815221 | ||
|
|
bd629ae454 | ||
|
|
41de75a584 | ||
|
|
96a426dc36 | ||
|
|
824dd40f7e | ||
|
|
fa2e649fe8 | ||
|
|
e25e8e3a41 | ||
|
|
aa3670a902 | ||
|
|
ef1f9205ac | ||
|
|
3228bbfc63 | ||
|
|
f18a0dfc4d |
@@ -103,7 +103,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"import azureml.core\n",
|
"import azureml.core\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print(\"This notebook was created using version 1.45.0 of the Azure ML SDK\")\n",
|
"print(\"This notebook was created using version Latest of the Azure ML SDK\")\n",
|
||||||
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
|
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -367,9 +367,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -398,7 +398,7 @@
|
|||||||
"# run_config.target = gpu_cluster_name\n",
|
"# run_config.target = gpu_cluster_name\n",
|
||||||
"# run_config.environment.docker.enabled = True\n",
|
"# run_config.environment.docker.enabled = True\n",
|
||||||
"# run_config.environment.docker.gpu_support = True\n",
|
"# run_config.environment.docker.gpu_support = True\n",
|
||||||
"# run_config.environment.docker.base_image = \"rapidsai/rapidsai:cuda9.2-runtime-ubuntu18.04\"\n",
|
"# run_config.environment.docker.base_image = \"rapidsai/rapidsai:cuda9.2-runtime-ubuntu20.04\"\n",
|
||||||
"# # run_config.environment.docker.base_image_registry.address = '<registry_url>' # not required if the base_image is in Docker hub\n",
|
"# # run_config.environment.docker.base_image_registry.address = '<registry_url>' # not required if the base_image is in Docker hub\n",
|
||||||
"# # run_config.environment.docker.base_image_registry.username = '<user_name>' # needed only for private images\n",
|
"# # run_config.environment.docker.base_image_registry.username = '<user_name>' # needed only for private images\n",
|
||||||
"# # run_config.environment.docker.base_image_registry.password = '<password>' # needed only for private images\n",
|
"# # run_config.environment.docker.base_image_registry.password = '<password>' # needed only for private images\n",
|
||||||
@@ -525,9 +525,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -599,9 +599,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ dependencies:
|
|||||||
- fairlearn>=0.6.2
|
- fairlearn>=0.6.2
|
||||||
- joblib
|
- joblib
|
||||||
- liac-arff
|
- liac-arff
|
||||||
- raiwidgets~=0.21.0
|
- raiwidgets~=0.24.0
|
||||||
- itsdangerous==2.0.1
|
- itsdangerous==2.0.1
|
||||||
- markupsafe<2.1.0
|
- markupsafe<2.1.0
|
||||||
- protobuf==3.20.0
|
- protobuf==3.20.0
|
||||||
|
- numpy<1.24.0
|
||||||
|
|||||||
@@ -523,9 +523,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ dependencies:
|
|||||||
- fairlearn>=0.6.2
|
- fairlearn>=0.6.2
|
||||||
- joblib
|
- joblib
|
||||||
- liac-arff
|
- liac-arff
|
||||||
- raiwidgets~=0.21.0
|
- raiwidgets~=0.24.0
|
||||||
- itsdangerous==2.0.1
|
- itsdangerous==2.0.1
|
||||||
- markupsafe<2.1.0
|
- markupsafe<2.1.0
|
||||||
- protobuf==3.20.0
|
- protobuf==3.20.0
|
||||||
|
- numpy<1.24.0
|
||||||
|
|||||||
@@ -5,32 +5,21 @@ channels:
|
|||||||
- main
|
- main
|
||||||
dependencies:
|
dependencies:
|
||||||
# The python interpreter version.
|
# The python interpreter version.
|
||||||
# Currently Azure ML only supports 3.6.0 and later.
|
# Azure ML only supports 3.7.0 and later.
|
||||||
- pip==20.2.4
|
- pip==22.3.1
|
||||||
- python>=3.6,<3.9
|
- python>=3.7,<3.9
|
||||||
- matplotlib==3.2.1
|
|
||||||
- py-xgboost==1.3.3
|
|
||||||
- pytorch::pytorch=1.4.0
|
|
||||||
- conda-forge::fbprophet==0.7.1
|
- conda-forge::fbprophet==0.7.1
|
||||||
- cudatoolkit=10.1.243
|
- pandas==1.1.5
|
||||||
- scipy==1.5.3
|
- scipy==1.5.3
|
||||||
- notebook
|
- Cython==0.29.14
|
||||||
- pywin32==227
|
- tqdm==4.64.1
|
||||||
- PySocks==1.7.1
|
|
||||||
- conda-forge::pyqt==5.12.3
|
|
||||||
- jsonschema==4.15.0
|
|
||||||
- jinja2<=2.11.2
|
|
||||||
- markupsafe<2.1.0
|
|
||||||
- tqdm==4.64.0
|
|
||||||
|
|
||||||
- pip:
|
- pip:
|
||||||
# Required packages for AzureML execution, history, and data preparation.
|
# Required packages for AzureML execution, history, and data preparation.
|
||||||
- azureml-widgets~=1.45.0
|
- azureml-widgets~=Latest
|
||||||
- azureml-defaults~=1.45.0
|
- azureml-defaults~=Latest
|
||||||
- pytorch-transformers==1.0.0
|
- -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/Latest/validated_win32_requirements.txt [--no-deps]
|
||||||
- spacy==2.2.4
|
- matplotlib==3.6.2
|
||||||
- pystan==2.19.1.1
|
- xgboost==1.3.3
|
||||||
- https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz
|
- cmdstanpy==0.9.5
|
||||||
- -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/1.45.0/validated_win32_requirements.txt [--no-deps]
|
- setuptools-git==1.2
|
||||||
- arch==4.14
|
|
||||||
- wasabi==0.9.1
|
|
||||||
|
|||||||
@@ -5,11 +5,9 @@ channels:
|
|||||||
- main
|
- main
|
||||||
dependencies:
|
dependencies:
|
||||||
# The python interpreter version.
|
# The python interpreter version.
|
||||||
# Currently Azure ML only supports 3.6.0 and later.
|
# Azure ML only supports 3.7 and later.
|
||||||
- pip==20.2.4
|
- pip==22.3.1
|
||||||
- python>=3.6,<3.9
|
- python>=3.7,<3.9
|
||||||
- boto3==1.20.19
|
|
||||||
- botocore<=1.23.19
|
|
||||||
- matplotlib==3.2.1
|
- matplotlib==3.2.1
|
||||||
- numpy>=1.21.6,<=1.22.3
|
- numpy>=1.21.6,<=1.22.3
|
||||||
- cython==0.29.14
|
- cython==0.29.14
|
||||||
@@ -19,18 +17,16 @@ dependencies:
|
|||||||
- py-xgboost<=1.3.3
|
- py-xgboost<=1.3.3
|
||||||
- holidays==0.10.3
|
- holidays==0.10.3
|
||||||
- conda-forge::fbprophet==0.7.1
|
- conda-forge::fbprophet==0.7.1
|
||||||
- pytorch::pytorch=1.4.0
|
- pytorch::pytorch=1.11.0
|
||||||
- cudatoolkit=10.1.243
|
- cudatoolkit=10.1.243
|
||||||
- jinja2<=2.11.2
|
- notebook
|
||||||
- markupsafe<2.1.0
|
|
||||||
|
|
||||||
- pip:
|
- pip:
|
||||||
# Required packages for AzureML execution, history, and data preparation.
|
# Required packages for AzureML execution, history, and data preparation.
|
||||||
- azureml-widgets~=1.45.0
|
- azureml-widgets~=Latest
|
||||||
- azureml-defaults~=1.45.0
|
- azureml-defaults~=Latest
|
||||||
- pytorch-transformers==1.0.0
|
- pytorch-transformers==1.0.0
|
||||||
- spacy==2.2.4
|
- spacy==2.2.4
|
||||||
- pystan==2.19.1.1
|
- pystan==2.19.1.1
|
||||||
- https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz
|
- https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz
|
||||||
- -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/1.45.0/validated_linux_requirements.txt [--no-deps]
|
- -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/Latest/validated_linux_requirements.txt [--no-deps]
|
||||||
- arch==4.14
|
|
||||||
|
|||||||
@@ -5,12 +5,9 @@ channels:
|
|||||||
- main
|
- main
|
||||||
dependencies:
|
dependencies:
|
||||||
# The python interpreter version.
|
# The python interpreter version.
|
||||||
# Currently Azure ML only supports 3.6.0 and later.
|
# Currently Azure ML only supports 3.7 and later.
|
||||||
- pip==20.2.4
|
- pip==22.3.1
|
||||||
- nomkl
|
- python>=3.7,<3.9
|
||||||
- python>=3.6,<3.9
|
|
||||||
- boto3==1.20.19
|
|
||||||
- botocore<=1.23.19
|
|
||||||
- matplotlib==3.2.1
|
- matplotlib==3.2.1
|
||||||
- numpy>=1.21.6,<=1.22.3
|
- numpy>=1.21.6,<=1.22.3
|
||||||
- cython==0.29.14
|
- cython==0.29.14
|
||||||
@@ -20,18 +17,16 @@ dependencies:
|
|||||||
- py-xgboost<=1.3.3
|
- py-xgboost<=1.3.3
|
||||||
- holidays==0.10.3
|
- holidays==0.10.3
|
||||||
- conda-forge::fbprophet==0.7.1
|
- conda-forge::fbprophet==0.7.1
|
||||||
- pytorch::pytorch=1.4.0
|
- pytorch::pytorch=1.11.0
|
||||||
- cudatoolkit=9.0
|
- cudatoolkit=9.0
|
||||||
- jinja2<=2.11.2
|
- notebook
|
||||||
- markupsafe<2.1.0
|
|
||||||
|
|
||||||
- pip:
|
- pip:
|
||||||
# Required packages for AzureML execution, history, and data preparation.
|
# Required packages for AzureML execution, history, and data preparation.
|
||||||
- azureml-widgets~=1.45.0
|
- azureml-widgets~=Latest
|
||||||
- azureml-defaults~=1.45.0
|
- azureml-defaults~=Latest
|
||||||
- pytorch-transformers==1.0.0
|
- pytorch-transformers==1.0.0
|
||||||
- spacy==2.2.4
|
- spacy==2.2.4
|
||||||
- pystan==2.19.1.1
|
- pystan==2.19.1.1
|
||||||
- https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz
|
- https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz
|
||||||
- -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/1.45.0/validated_darwin_requirements.txt [--no-deps]
|
- -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/Latest/validated_darwin_requirements.txt [--no-deps]
|
||||||
- arch==4.14
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ if not errorlevel 1 (
|
|||||||
call conda env create -f %automl_env_file% -n %conda_env_name%
|
call conda env create -f %automl_env_file% -n %conda_env_name%
|
||||||
)
|
)
|
||||||
|
|
||||||
|
python "%conda_prefix%\scripts\pywin32_postinstall.py" -install
|
||||||
|
|
||||||
call conda activate %conda_env_name% 2>nul:
|
call conda activate %conda_env_name% 2>nul:
|
||||||
if errorlevel 1 goto ErrorExit
|
if errorlevel 1 goto ErrorExit
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from distutils.version import LooseVersion
|
from setuptools._vendor.packaging import version
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -17,7 +17,7 @@ if architecture != "64bit":
|
|||||||
|
|
||||||
minimumVersion = "4.7.8"
|
minimumVersion = "4.7.8"
|
||||||
|
|
||||||
versionInvalid = (LooseVersion(conda.__version__) < LooseVersion(minimumVersion))
|
versionInvalid = (version.parse(conda.__version__) < version.parse(minimumVersion))
|
||||||
|
|
||||||
if versionInvalid:
|
if versionInvalid:
|
||||||
print('Setup requires conda version ' + minimumVersion + ' or higher.')
|
print('Setup requires conda version ' + minimumVersion + ' or higher.')
|
||||||
|
|||||||
@@ -1060,9 +1060,9 @@
|
|||||||
"name": "python3-azureml"
|
"name": "python3-azureml"
|
||||||
},
|
},
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -456,9 +456,9 @@
|
|||||||
"friendly_name": "Classification of credit card fraudulent transactions using Automated ML",
|
"friendly_name": "Classification of credit card fraudulent transactions using Automated ML",
|
||||||
"index_order": 5,
|
"index_order": 5,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -567,9 +567,9 @@
|
|||||||
"friendly_name": "DNN Text Featurization",
|
"friendly_name": "DNN Text Featurization",
|
||||||
"index_order": 2,
|
"index_order": 2,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -564,9 +564,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"print(\"This notebook was created using version 1.45.0 of the Azure ML SDK\")\n",
|
"print(\"This notebook was created using version Latest of the Azure ML SDK\")\n",
|
||||||
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
|
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -324,9 +324,9 @@
|
|||||||
"hash": "adb464b67752e4577e3dc163235ced27038d19b7d88def00d75d1975bde5d9ab"
|
"hash": "adb464b67752e4577e3dc163235ced27038d19b7d88def00d75d1975bde5d9ab"
|
||||||
},
|
},
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"print(\"This notebook was created using version 1.45.0 of the Azure ML SDK\")\n",
|
"print(\"This notebook was created using version Latest of the Azure ML SDK\")\n",
|
||||||
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
|
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -713,9 +713,9 @@
|
|||||||
"hash": "adb464b67752e4577e3dc163235ced27038d19b7d88def00d75d1975bde5d9ab"
|
"hash": "adb464b67752e4577e3dc163235ced27038d19b7d88def00d75d1975bde5d9ab"
|
||||||
},
|
},
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -1,20 +1,12 @@
|
|||||||
name: azure_automl_experimental
|
name: azure_automl_experimental
|
||||||
dependencies:
|
dependencies:
|
||||||
# The python interpreter version.
|
# The python interpreter version.
|
||||||
# Currently Azure ML only supports 3.6.0 and later.
|
# Currently Azure ML only supports 3.7.0 and later.
|
||||||
- pip<=20.2.4
|
- pip<=22.3.1
|
||||||
- python>=3.6.0,<3.10
|
- python>=3.7.0,<3.11
|
||||||
- cython==0.29.14
|
|
||||||
- urllib3==1.26.7
|
|
||||||
- PyJWT < 2.0.0
|
|
||||||
- numpy==1.21.6
|
|
||||||
- pywin32==227
|
|
||||||
- cryptography<37.0.0
|
|
||||||
|
|
||||||
- pip:
|
- pip:
|
||||||
# Required packages for AzureML execution, history, and data preparation.
|
# Required packages for AzureML execution, history, and data preparation.
|
||||||
- azure-core==1.24.1
|
|
||||||
- azure-identity==1.7.0
|
|
||||||
- azureml-defaults
|
- azureml-defaults
|
||||||
- azureml-sdk
|
- azureml-sdk
|
||||||
- azureml-widgets
|
- azureml-widgets
|
||||||
|
|||||||
@@ -4,14 +4,13 @@ channels:
|
|||||||
- main
|
- main
|
||||||
dependencies:
|
dependencies:
|
||||||
# The python interpreter version.
|
# The python interpreter version.
|
||||||
# Currently Azure ML only supports 3.6.0 and later.
|
# Currently Azure ML only supports 3.7.0 and later.
|
||||||
- pip<=20.2.4
|
- pip<=20.2.4
|
||||||
- nomkl
|
- nomkl
|
||||||
- python>=3.6.0,<3.10
|
- python>=3.7.0,<3.11
|
||||||
- urllib3==1.26.7
|
- urllib3==1.26.7
|
||||||
- PyJWT < 2.0.0
|
- PyJWT < 2.0.0
|
||||||
- numpy>=1.21.6,<=1.22.3
|
- numpy>=1.21.6,<=1.22.3
|
||||||
- cryptography<37.0.0
|
|
||||||
|
|
||||||
- pip:
|
- pip:
|
||||||
# Required packages for AzureML execution, history, and data preparation.
|
# Required packages for AzureML execution, history, and data preparation.
|
||||||
|
|||||||
@@ -92,7 +92,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"print(\"This notebook was created using version 1.45.0 of the Azure ML SDK\")\n",
|
"print(\"This notebook was created using version Latest of the Azure ML SDK\")\n",
|
||||||
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
|
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -354,7 +354,7 @@
|
|||||||
"This Credit Card fraud Detection dataset is made available under the Open Database License: http://opendatacommons.org/licenses/odbl/1.0/. Any rights in individual contents of the database are licensed under the Database Contents License: http://opendatacommons.org/licenses/dbcl/1.0/ and is available at: https://www.kaggle.com/mlg-ulb/creditcardfraud\n",
|
"This Credit Card fraud Detection dataset is made available under the Open Database License: http://opendatacommons.org/licenses/odbl/1.0/. Any rights in individual contents of the database are licensed under the Database Contents License: http://opendatacommons.org/licenses/dbcl/1.0/ and is available at: https://www.kaggle.com/mlg-ulb/creditcardfraud\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"The dataset has been collected and analysed during a research collaboration of Worldline and the Machine Learning Group (http://mlg.ulb.ac.be) of ULB (Universit\u00c3\u0192\u00c2\u00a9 Libre de Bruxelles) on big data mining and fraud detection. More details on current and past projects on related topics are available on https://www.researchgate.net/project/Fraud-detection-5 and the page of the DefeatFraud project\n",
|
"The dataset has been collected and analysed during a research collaboration of Worldline and the Machine Learning Group (http://mlg.ulb.ac.be) of ULB (Universit\u00c3\u0192\u00c2\u00a9 Libre de Bruxelles) on big data mining and fraud detection. More details on current and past projects on related topics are available on https://www.researchgate.net and the page of the DefeatFraud project\n",
|
||||||
"Please cite the following works: \n",
|
"Please cite the following works: \n",
|
||||||
"\u00c3\u00a2\u00e2\u201a\u00ac\u00c2\u00a2\tAndrea Dal Pozzolo, Olivier Caelen, Reid A. Johnson and Gianluca Bontempi. Calibrating Probability with Undersampling for Unbalanced Classification. In Symposium on Computational Intelligence and Data Mining (CIDM), IEEE, 2015\n",
|
"\u00c3\u00a2\u00e2\u201a\u00ac\u00c2\u00a2\tAndrea Dal Pozzolo, Olivier Caelen, Reid A. Johnson and Gianluca Bontempi. Calibrating Probability with Undersampling for Unbalanced Classification. In Symposium on Computational Intelligence and Data Mining (CIDM), IEEE, 2015\n",
|
||||||
"\u00c3\u00a2\u00e2\u201a\u00ac\u00c2\u00a2\tDal Pozzolo, Andrea; Caelen, Olivier; Le Borgne, Yann-Ael; Waterschoot, Serge; Bontempi, Gianluca. Learned lessons in credit card fraud detection from a practitioner perspective, Expert systems with applications,41,10,4915-4928,2014, Pergamon\n",
|
"\u00c3\u00a2\u00e2\u201a\u00ac\u00c2\u00a2\tDal Pozzolo, Andrea; Caelen, Olivier; Le Borgne, Yann-Ael; Waterschoot, Serge; Bontempi, Gianluca. Learned lessons in credit card fraud detection from a practitioner perspective, Expert systems with applications,41,10,4915-4928,2014, Pergamon\n",
|
||||||
@@ -389,9 +389,9 @@
|
|||||||
"friendly_name": "Classification of credit card fraudulent transactions using Automated ML",
|
"friendly_name": "Classification of credit card fraudulent transactions using Automated ML",
|
||||||
"index_order": 5,
|
"index_order": 5,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"print(\"This notebook was created using version 1.45.0 of the Azure ML SDK\")\n",
|
"print(\"This notebook was created using version Latest of the Azure ML SDK\")\n",
|
||||||
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
|
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -448,9 +448,9 @@
|
|||||||
"automated-machine-learning"
|
"automated-machine-learning"
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -122,7 +122,10 @@ def calculate_scores_and_build_plots(
|
|||||||
input_dir: str, output_dir: str, automl_settings: Dict[str, Any]
|
input_dir: str, output_dir: str, automl_settings: Dict[str, Any]
|
||||||
):
|
):
|
||||||
os.makedirs(output_dir, exist_ok=True)
|
os.makedirs(output_dir, exist_ok=True)
|
||||||
grains = automl_settings.get(constants.TimeSeries.TIME_SERIES_ID_COLUMN_NAMES)
|
grains = automl_settings.get(
|
||||||
|
constants.TimeSeries.TIME_SERIES_ID_COLUMN_NAMES,
|
||||||
|
automl_settings.get(constants.TimeSeries.GRAIN_COLUMN_NAMES, None),
|
||||||
|
)
|
||||||
time_column_name = automl_settings.get(constants.TimeSeries.TIME_COLUMN_NAME)
|
time_column_name = automl_settings.get(constants.TimeSeries.TIME_COLUMN_NAME)
|
||||||
if grains is None:
|
if grains is None:
|
||||||
grains = []
|
grains = []
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
"For this notebook we are using a synthetic dataset to demonstrate the back testing in many model scenario. This allows us to check historical performance of AutoML on a historical data. To do that we step back on the backtesting period by the data set several times and split the data to train and test sets. Then these data sets are used for training and evaluation of model.<br>\n",
|
"For this notebook we are using a synthetic dataset to demonstrate the back testing in many model scenario. This allows us to check historical performance of AutoML on a historical data. To do that we step back on the backtesting period by the data set several times and split the data to train and test sets. Then these data sets are used for training and evaluation of model.<br>\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Thus, it is a quick way of evaluating AutoML as if it was in production. Here, we do not test historical performance of a particular model, for this see the [notebook](../forecasting-backtest-single-model/auto-ml-forecasting-backtest-single-model.ipynb). Instead, the best model for every backtest iteration can be different since AutoML chooses the best model for a given training set.\n",
|
"Thus, it is a quick way of evaluating AutoML as if it was in production. Here, we do not test historical performance of a particular model, for this see the [notebook](../forecasting-backtest-single-model/auto-ml-forecasting-backtest-single-model.ipynb). Instead, the best model for every backtest iteration can be different since AutoML chooses the best model for a given training set.\n",
|
||||||
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"**NOTE: There are limits on how many runs we can do in parallel per workspace, and we currently recommend to set the parallelism to maximum of 320 runs per experiment per workspace. If users want to have more parallelism and increase this limit they might encounter Too Many Requests errors (HTTP 429).**"
|
"**NOTE: There are limits on how many runs we can do in parallel per workspace, and we currently recommend to set the parallelism to maximum of 320 runs per experiment per workspace. If users want to have more parallelism and increase this limit they might encounter Too Many Requests errors (HTTP 429).**"
|
||||||
@@ -43,7 +44,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"### Prerequisites\n",
|
"### Prerequisites\n",
|
||||||
"You'll need to create a compute Instance by following the instructions in the [EnvironmentSetup.md](../Setup_Resources/EnvironmentSetup.md)."
|
"You'll need to create a compute Instance by following [these](https://learn.microsoft.com/en-us/azure/machine-learning/v1/how-to-create-manage-compute-instance?tabs=python) instructions."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -313,22 +314,37 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"### Set up training parameters\n",
|
"### Set up training parameters\n",
|
||||||
"\n",
|
"\n",
|
||||||
"This dictionary defines the AutoML and many models settings. For this forecasting task we need to define several settings including the name of the time column, the maximum forecast horizon, and the partition column name definition. Please note, that in this case we are setting grain_column_names to be the time series ID column plus iteration, because we want to train a separate model for each time series and iteration.\n",
|
"We need to provide ``ForecastingParameters``, ``AutoMLConfig`` and ``ManyModelsTrainParameters`` objects. For the forecasting task we also need to define several settings including the name of the time column, the maximum forecast horizon, and the partition column name(s) definition.\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
"#### ``ForecastingParameters`` arguments\n",
|
||||||
|
"| Property | Description|\n",
|
||||||
|
"| :--------------- | :------------------- |\n",
|
||||||
|
"| **forecast_horizon** | The forecast horizon is how many periods forward you would like to forecast. This integer horizon is in units of the timeseries frequency (e.g. daily, weekly). Periods are inferred from your data. |\n",
|
||||||
|
"| **time_column_name** | The name of your time column. |\n",
|
||||||
|
"| **time_series_id_column_names** | The column names used to uniquely identify timeseries in data that has multiple rows with the same timestamp. |\n",
|
||||||
|
"| **cv_step_size** | Number of periods between two consecutive cross-validation folds. The default value is \\\"auto\\\", in which case AutoMl determines the cross-validation step size automatically, if a validation set is not provided. Or users could specify an integer value. |\n",
|
||||||
|
"\n",
|
||||||
|
"#### ``AutoMLConfig`` arguments\n",
|
||||||
"| Property | Description|\n",
|
"| Property | Description|\n",
|
||||||
"| :--------------- | :------------------- |\n",
|
"| :--------------- | :------------------- |\n",
|
||||||
"| **task** | forecasting |\n",
|
"| **task** | forecasting |\n",
|
||||||
"| **primary_metric** | This is the metric that you want to optimize.<br> Forecasting supports the following primary metrics <br><i>normalized_root_mean_squared_error</i><br><i>normalized_mean_absolute_error</i> |\n",
|
"| **primary_metric** | This is the metric that you want to optimize.<br> Forecasting supports the following primary metrics <br><i>spearman_correlation</i><br><i>normalized_root_mean_squared_error</i><br><i>r2_score</i><br><i>normalized_mean_absolute_error</i> |\n",
|
||||||
|
"| **blocked_models** | Blocked models won't be used by AutoML. |\n",
|
||||||
"| **iteration_timeout_minutes** | Maximum amount of time in minutes that the model can train. This is optional but provides customers with greater control on exit criteria. |\n",
|
"| **iteration_timeout_minutes** | Maximum amount of time in minutes that the model can train. This is optional but provides customers with greater control on exit criteria. |\n",
|
||||||
"| **iterations** | Number of models to train. This is optional but provides customers with greater control on exit criteria. |\n",
|
"| **iterations** | Number of models to train. This is optional but provides customers with greater control on exit criteria. |\n",
|
||||||
"| **experiment_timeout_hours** | Maximum amount of time in hours that the experiment can take before it terminates. This is optional but provides customers with greater control on exit criteria. |\n",
|
"| **experiment_timeout_hours** | Maximum amount of time in hours that each experiment can take before it terminates. This is optional but provides customers with greater control on exit criteria. **It does not control the overall timeout for the pipeline run, instead controls the timeout for each training run per partitioned time series.** |\n",
|
||||||
"| **label_column_name** | The name of the label column. |\n",
|
"| **label_column_name** | The name of the label column. |\n",
|
||||||
"| **forecast_horizon** | The forecast horizon is how many periods forward you would like to forecast. This integer horizon is in units of the timeseries frequency (e.g. daily, weekly). Periods are inferred from your data. |\n",
|
"| **n_cross_validations** | Number of cross validation splits. The default value is \\\"auto\\\", in which case AutoMl determines the number of cross-validations automatically, if a validation set is not provided. Or users could specify an integer value. Rolling Origin Validation is used to split time-series in a temporally consistent way. |\n",
|
||||||
"| **n_cross_validations** | Number of cross validation splits. The default value is \"auto\", in which case AutoMl determines the number of cross-validations automatically, if a validation set is not provided. Or users could specify an integer value. Rolling Origin Validation is used to split time-series in a temporally consistent way. |\n",
|
"| **enable_early_stopping** | Flag to enable early termination if the primary metric is no longer improving. |\n",
|
||||||
"|**cv_step_size**|Number of periods between two consecutive cross-validation folds. The default value is \"auto\", in which case AutoMl determines the cross-validation step size automatically, if a validation set is not provided. Or users could specify an integer value.\n",
|
"| **enable_engineered_explanations** | Engineered feature explanations will be downloaded if enable_engineered_explanations flag is set to True. By default it is set to False to save storage space. |\n",
|
||||||
"| **time_column_name** | The name of your time column. |\n",
|
|
||||||
"| **time_series_id_column_names** | The column names used to uniquely identify timeseries in data that has multiple rows with the same timestamp. |\n",
|
|
||||||
"| **track_child_runs** | Flag to disable tracking of child runs. Only best run is tracked if the flag is set to False (this includes the model and metrics of the run). |\n",
|
"| **track_child_runs** | Flag to disable tracking of child runs. Only best run is tracked if the flag is set to False (this includes the model and metrics of the run). |\n",
|
||||||
|
"| **pipeline_fetch_max_batch_size** | Determines how many pipelines (training algorithms) to fetch at a time for training, this helps reduce throttling when training at large scale. |\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"#### ``ManyModelsTrainParameters`` arguments\n",
|
||||||
|
"| Property | Description|\n",
|
||||||
|
"| :--------------- | :------------------- |\n",
|
||||||
|
"| **automl_settings** | The ``AutoMLConfig`` object defined above. |\n",
|
||||||
"| **partition_column_names** | The names of columns used to group your models. For timeseries, the groups must not split up individual time-series. That is, each group must contain one or more whole time-series. |"
|
"| **partition_column_names** | The names of columns used to group your models. For timeseries, the groups must not split up individual time-series. That is, each group must contain one or more whole time-series. |"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -345,22 +361,30 @@
|
|||||||
"from azureml.train.automl.runtime._many_models.many_models_parameters import (\n",
|
"from azureml.train.automl.runtime._many_models.many_models_parameters import (\n",
|
||||||
" ManyModelsTrainParameters,\n",
|
" ManyModelsTrainParameters,\n",
|
||||||
")\n",
|
")\n",
|
||||||
|
"from azureml.automl.core.forecasting_parameters import ForecastingParameters\n",
|
||||||
|
"from azureml.train.automl.automlconfig import AutoMLConfig\n",
|
||||||
"\n",
|
"\n",
|
||||||
"partition_column_names = [TIME_SERIES_ID_COLNAME, \"backtest_iteration\"]\n",
|
"partition_column_names = [TIME_SERIES_ID_COLNAME, \"backtest_iteration\"]\n",
|
||||||
"automl_settings = {\n",
|
"\n",
|
||||||
" \"task\": \"forecasting\",\n",
|
"forecasting_parameters = ForecastingParameters(\n",
|
||||||
" \"primary_metric\": \"normalized_root_mean_squared_error\",\n",
|
" time_column_name=TIME_COLNAME,\n",
|
||||||
" \"iteration_timeout_minutes\": 10, # This needs to be changed based on the dataset. We ask customer to explore how long training is taking before settings this value\n",
|
" forecast_horizon=6,\n",
|
||||||
" \"iterations\": 15,\n",
|
" time_series_id_column_names=partition_column_names,\n",
|
||||||
" \"experiment_timeout_hours\": 0.25, # This also needs to be changed based on the dataset. For larger data set this number needs to be bigger.\n",
|
" cv_step_size=\"auto\",\n",
|
||||||
" \"label_column_name\": TARGET_COLNAME,\n",
|
")\n",
|
||||||
" \"n_cross_validations\": \"auto\", # Feel free to set to a small integer (>=2) if runtime is an issue.\n",
|
"\n",
|
||||||
" \"cv_step_size\": \"auto\",\n",
|
"automl_settings = AutoMLConfig(\n",
|
||||||
" \"time_column_name\": TIME_COLNAME,\n",
|
" task=\"forecasting\",\n",
|
||||||
" \"forecast_horizon\": 6,\n",
|
" primary_metric=\"normalized_root_mean_squared_error\",\n",
|
||||||
" \"time_series_id_column_names\": partition_column_names,\n",
|
" iteration_timeout_minutes=10,\n",
|
||||||
" \"track_child_runs\": False,\n",
|
" iterations=15,\n",
|
||||||
"}\n",
|
" experiment_timeout_hours=0.25,\n",
|
||||||
|
" label_column_name=TARGET_COLNAME,\n",
|
||||||
|
" n_cross_validations=\"auto\", # Feel free to set to a small integer (>=2) if runtime is an issue.\n",
|
||||||
|
" track_child_runs=False,\n",
|
||||||
|
" forecasting_parameters=forecasting_parameters,\n",
|
||||||
|
")\n",
|
||||||
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"mm_paramters = ManyModelsTrainParameters(\n",
|
"mm_paramters = ManyModelsTrainParameters(\n",
|
||||||
" automl_settings=automl_settings, partition_column_names=partition_column_names\n",
|
" automl_settings=automl_settings, partition_column_names=partition_column_names\n",
|
||||||
@@ -387,8 +411,16 @@
|
|||||||
"| **node_count** | The number of compute nodes to be used for running the user script. We recommend to start with 3 and increase the node_count if the training time is taking too long. |\n",
|
"| **node_count** | The number of compute nodes to be used for running the user script. We recommend to start with 3 and increase the node_count if the training time is taking too long. |\n",
|
||||||
"| **process_count_per_node** | Process count per node, we recommend 2:1 ratio for number of cores: number of processes per node. eg. If node has 16 cores then configure 8 or less process count per node or optimal performance. |\n",
|
"| **process_count_per_node** | Process count per node, we recommend 2:1 ratio for number of cores: number of processes per node. eg. If node has 16 cores then configure 8 or less process count per node or optimal performance. |\n",
|
||||||
"| **train_pipeline_parameters** | The set of configuration parameters defined in the previous section. |\n",
|
"| **train_pipeline_parameters** | The set of configuration parameters defined in the previous section. |\n",
|
||||||
|
"| **run_invocation_timeout** | Maximum amount of time in seconds that the ``ParallelRunStep`` class is allowed. This is optional but provides customers with greater control on exit criteria. This must be greater than ``experiment_timeout_hours`` by at least 300 seconds. |\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Calling this method will create a new aggregated dataset which is generated dynamically on pipeline execution."
|
"Calling this method will create a new aggregated dataset which is generated dynamically on pipeline execution.\n",
|
||||||
|
"\n",
|
||||||
|
"**Note**: Total time taken for the **training step** in the pipeline to complete = $ \\frac{t}{ p \\times n } \\times ts $\n",
|
||||||
|
"where,\n",
|
||||||
|
"- $ t $ is time taken for training one partition (can be viewed in the training logs)\n",
|
||||||
|
"- $ p $ is ``process_count_per_node``\n",
|
||||||
|
"- $ n $ is ``node_count``\n",
|
||||||
|
"- $ ts $ is total number of partitions in time series based on ``partition_column_names``"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -406,7 +438,7 @@
|
|||||||
" compute_target=compute_target,\n",
|
" compute_target=compute_target,\n",
|
||||||
" node_count=2,\n",
|
" node_count=2,\n",
|
||||||
" process_count_per_node=2,\n",
|
" process_count_per_node=2,\n",
|
||||||
" run_invocation_timeout=920,\n",
|
" run_invocation_timeout=1200,\n",
|
||||||
" train_pipeline_parameters=mm_paramters,\n",
|
" train_pipeline_parameters=mm_paramters,\n",
|
||||||
")"
|
")"
|
||||||
]
|
]
|
||||||
@@ -491,25 +523,31 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"For many models we need to provide the ManyModelsInferenceParameters object.\n",
|
"For many models we need to provide the ManyModelsInferenceParameters object.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"#### ManyModelsInferenceParameters arguments\n",
|
"#### ``ManyModelsInferenceParameters`` arguments\n",
|
||||||
"| Property | Description|\n",
|
"| Property | Description|\n",
|
||||||
"| :--------------- | :------------------- |\n",
|
"| :--------------- | :------------------- |\n",
|
||||||
"| **partition_column_names** | List of column names that identifies groups. |\n",
|
"| **partition_column_names** | List of column names that identifies groups. |\n",
|
||||||
"| **target_column_name** | \\[Optional\\] Column name only if the inference dataset has the target. |\n",
|
"| **target_column_name** | \\[Optional] Column name only if the inference dataset has the target. |\n",
|
||||||
"| **time_column_name** | Column name only if it is timeseries. |\n",
|
"| **time_column_name** | \\[Optional] Time column name only if it is timeseries. |\n",
|
||||||
"| **many_models_run_id** | \\[Optional\\] Many models pipeline run id where models were trained. |\n",
|
"| **inference_type** | \\[Optional] Which inference method to use on the model. Possible values are 'forecast', 'predict_proba', and 'predict'. |\n",
|
||||||
|
"| **forecast_mode** | \\[Optional] The type of forecast to be used, either 'rolling' or 'recursive'; defaults to 'recursive'. |\n",
|
||||||
|
"| **step** | \\[Optional] Number of periods to advance the forecasting window in each iteration **(for rolling forecast only)**; defaults to 1. |\n",
|
||||||
"\n",
|
"\n",
|
||||||
"#### get_many_models_batch_inference_steps arguments\n",
|
"#### ``get_many_models_batch_inference_steps`` arguments\n",
|
||||||
"| Property | Description|\n",
|
"| Property | Description|\n",
|
||||||
"| :--------------- | :------------------- |\n",
|
"| :--------------- | :------------------- |\n",
|
||||||
"| **experiment** | The experiment used for inference run. |\n",
|
"| **experiment** | The experiment used for inference run. |\n",
|
||||||
"| **inference_data** | The data to use for inferencing. It should be the same schema as used for training.\n",
|
"| **inference_data** | The data to use for inferencing. It should be the same schema as used for training.\n",
|
||||||
"| **compute_target** | The compute target that runs the inference pipeline.|\n",
|
"| **compute_target** | The compute target that runs the inference pipeline. |\n",
|
||||||
"| **node_count** | The number of compute nodes to be used for running the user script. We recommend to start with the number of cores per node (varies by compute sku). |\n",
|
"| **node_count** | The number of compute nodes to be used for running the user script. We recommend to start with the number of cores per node (varies by compute sku). |\n",
|
||||||
"| **process_count_per_node** | The number of processes per node.\n",
|
"| **process_count_per_node** | \\[Optional] The number of processes per node. By default it's 2 (should be at most half of the number of cores in a single node of the compute cluster that will be used for the experiment).\n",
|
||||||
"| **train_run_id** | \\[Optional\\] The run id of the hierarchy training, by default it is the latest successful training many model run in the experiment. |\n",
|
"| **inference_pipeline_parameters** | \\[Optional] The ``ManyModelsInferenceParameters`` object defined above. |\n",
|
||||||
"| **train_experiment_name** | \\[Optional\\] The train experiment that contains the train pipeline. This one is only needed when the train pipeline is not in the same experiement as the inference pipeline. |\n",
|
"| **append_row_file_name** | \\[Optional] The name of the output file (optional, default value is 'parallel_run_step.txt'). Supports 'txt' and 'csv' file extension. A 'txt' file extension generates the output in 'txt' format with space as separator without column names. A 'csv' file extension generates the output in 'csv' format with comma as separator and with column names. |\n",
|
||||||
"| **process_count_per_node** | \\[Optional\\] The number of processes per node, by default it's 4. |"
|
"| **train_run_id** | \\[Optional] The run id of the **training pipeline**. By default it is the latest successful training pipeline run in the experiment. |\n",
|
||||||
|
"| **train_experiment_name** | \\[Optional] The train experiment that contains the train pipeline. This one is only needed when the train pipeline is not in the same experiement as the inference pipeline. |\n",
|
||||||
|
"| **run_invocation_timeout** | \\[Optional] Maximum amount of time in seconds that the ``ParallelRunStep`` class is allowed. This is optional but provides customers with greater control on exit criteria. |\n",
|
||||||
|
"| **output_datastore** | \\[Optional] The ``Datastore`` or ``OutputDatasetConfig`` to be used for output. If specified any pipeline output will be written to that location. If unspecified the default datastore will be used. |\n",
|
||||||
|
"| **arguments** | \\[Optional] Arguments to be passed to inference script. Possible argument is '--forecast_quantiles' followed by quantile values. |"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -529,6 +567,8 @@
|
|||||||
" target_column_name=TARGET_COLNAME,\n",
|
" target_column_name=TARGET_COLNAME,\n",
|
||||||
")\n",
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
"output_file_name = \"parallel_run_step.csv\"\n",
|
||||||
|
"\n",
|
||||||
"inference_steps = AutoMLPipelineBuilder.get_many_models_batch_inference_steps(\n",
|
"inference_steps = AutoMLPipelineBuilder.get_many_models_batch_inference_steps(\n",
|
||||||
" experiment=experiment,\n",
|
" experiment=experiment,\n",
|
||||||
" inference_data=test_data,\n",
|
" inference_data=test_data,\n",
|
||||||
@@ -540,6 +580,7 @@
|
|||||||
" train_run_id=training_run.id,\n",
|
" train_run_id=training_run.id,\n",
|
||||||
" train_experiment_name=training_run.experiment.name,\n",
|
" train_experiment_name=training_run.experiment.name,\n",
|
||||||
" inference_pipeline_parameters=mm_parameters,\n",
|
" inference_pipeline_parameters=mm_parameters,\n",
|
||||||
|
" append_row_file_name=output_file_name,\n",
|
||||||
")"
|
")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -587,18 +628,21 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"from azureml.contrib.automl.pipeline.steps.utilities import get_output_from_mm_pipeline\n",
|
"from azureml.contrib.automl.pipeline.steps.utilities import get_output_from_mm_pipeline\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
"PREDICTION_COLNAME = \"Predictions\"\n",
|
||||||
"forecasting_results_name = \"forecasting_results\"\n",
|
"forecasting_results_name = \"forecasting_results\"\n",
|
||||||
"forecasting_output_name = \"many_models_inference_output\"\n",
|
"forecasting_output_name = \"many_models_inference_output\"\n",
|
||||||
"forecast_file = get_output_from_mm_pipeline(\n",
|
"forecast_file = get_output_from_mm_pipeline(\n",
|
||||||
" inference_run, forecasting_results_name, forecasting_output_name\n",
|
" inference_run, forecasting_results_name, forecasting_output_name, output_file_name\n",
|
||||||
")\n",
|
")\n",
|
||||||
"df = pd.read_csv(forecast_file, delimiter=\" \", header=None, parse_dates=[0])\n",
|
"df = pd.read_csv(forecast_file, parse_dates=[0])\n",
|
||||||
"df.columns = list(X_train.columns) + [\"predicted_level\"]\n",
|
|
||||||
"print(\n",
|
"print(\n",
|
||||||
" \"Prediction has \", df.shape[0], \" rows. Here the first 10 rows are being displayed.\"\n",
|
" \"Prediction has \", df.shape[0], \" rows. Here the first 10 rows are being displayed.\"\n",
|
||||||
")\n",
|
")\n",
|
||||||
"# Save the scv file with header to read it in the next step.\n",
|
"# Save the csv file to read it in the next step.\n",
|
||||||
"df.rename(columns={TARGET_COLNAME: \"actual_level\"}, inplace=True)\n",
|
"df.rename(\n",
|
||||||
|
" columns={TARGET_COLNAME: \"actual_level\", PREDICTION_COLNAME: \"predicted_level\"},\n",
|
||||||
|
" inplace=True,\n",
|
||||||
|
")\n",
|
||||||
"df.to_csv(os.path.join(forecasting_results_name, \"forecast.csv\"), index=False)\n",
|
"df.to_csv(os.path.join(forecasting_results_name, \"forecast.csv\"), index=False)\n",
|
||||||
"df.head(10)"
|
"df.head(10)"
|
||||||
]
|
]
|
||||||
@@ -622,7 +666,9 @@
|
|||||||
"backtesting_results = \"backtesting_mm_results\"\n",
|
"backtesting_results = \"backtesting_mm_results\"\n",
|
||||||
"os.makedirs(backtesting_results, exist_ok=True)\n",
|
"os.makedirs(backtesting_results, exist_ok=True)\n",
|
||||||
"calculate_scores_and_build_plots(\n",
|
"calculate_scores_and_build_plots(\n",
|
||||||
" forecasting_results_name, backtesting_results, automl_settings\n",
|
" forecasting_results_name,\n",
|
||||||
|
" backtesting_results,\n",
|
||||||
|
" automl_settings.as_serializable_dict(),\n",
|
||||||
")\n",
|
")\n",
|
||||||
"pd.DataFrame({\"File\": os.listdir(backtesting_results)})"
|
"pd.DataFrame({\"File\": os.listdir(backtesting_results)})"
|
||||||
]
|
]
|
||||||
@@ -706,9 +752,9 @@
|
|||||||
"automated-machine-learning"
|
"automated-machine-learning"
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -43,11 +43,20 @@ def init():
|
|||||||
global output_dir
|
global output_dir
|
||||||
global automl_settings
|
global automl_settings
|
||||||
global model_uid
|
global model_uid
|
||||||
|
global forecast_quantiles
|
||||||
|
|
||||||
logger.info("Initialization of the run.")
|
logger.info("Initialization of the run.")
|
||||||
parser = argparse.ArgumentParser("Parsing input arguments.")
|
parser = argparse.ArgumentParser("Parsing input arguments.")
|
||||||
parser.add_argument("--output-dir", dest="out", required=True)
|
parser.add_argument("--output-dir", dest="out", required=True)
|
||||||
parser.add_argument("--model-name", dest="model", default=None)
|
parser.add_argument("--model-name", dest="model", default=None)
|
||||||
parser.add_argument("--model-uid", dest="model_uid", default=None)
|
parser.add_argument("--model-uid", dest="model_uid", default=None)
|
||||||
|
parser.add_argument(
|
||||||
|
"--forecast_quantiles",
|
||||||
|
nargs="*",
|
||||||
|
type=float,
|
||||||
|
help="forecast quantiles list",
|
||||||
|
default=None,
|
||||||
|
)
|
||||||
|
|
||||||
parsed_args, _ = parser.parse_known_args()
|
parsed_args, _ = parser.parse_known_args()
|
||||||
model_name = parsed_args.model
|
model_name = parsed_args.model
|
||||||
@@ -55,6 +64,7 @@ def init():
|
|||||||
target_column_name = automl_settings.get("label_column_name")
|
target_column_name = automl_settings.get("label_column_name")
|
||||||
output_dir = parsed_args.out
|
output_dir = parsed_args.out
|
||||||
model_uid = parsed_args.model_uid
|
model_uid = parsed_args.model_uid
|
||||||
|
forecast_quantiles = parsed_args.forecast_quantiles
|
||||||
os.makedirs(output_dir, exist_ok=True)
|
os.makedirs(output_dir, exist_ok=True)
|
||||||
os.environ["AUTOML_IGNORE_PACKAGE_VERSION_INCOMPATIBILITIES".lower()] = "True"
|
os.environ["AUTOML_IGNORE_PACKAGE_VERSION_INCOMPATIBILITIES".lower()] = "True"
|
||||||
|
|
||||||
@@ -126,23 +136,18 @@ def run_backtest(data_input_name: str, file_name: str, experiment: Experiment):
|
|||||||
)
|
)
|
||||||
print(f"The model {best_run.properties['model_name']} was registered.")
|
print(f"The model {best_run.properties['model_name']} was registered.")
|
||||||
|
|
||||||
_, x_pred = fitted_model.forecast(X_test)
|
# By default we will have forecast quantiles of 0.5, which is our target
|
||||||
x_pred.reset_index(inplace=True, drop=False)
|
if forecast_quantiles:
|
||||||
columns = [automl_settings[constants.TimeSeries.TIME_COLUMN_NAME]]
|
if 0.5 not in forecast_quantiles:
|
||||||
if automl_settings.get(constants.TimeSeries.GRAIN_COLUMN_NAMES):
|
forecast_quantiles.append(0.5)
|
||||||
# We know that fitted_model.grain_column_names is a list.
|
fitted_model.quantiles = forecast_quantiles
|
||||||
columns.extend(fitted_model.grain_column_names)
|
|
||||||
columns.append(constants.TimeSeriesInternal.DUMMY_TARGET_COLUMN)
|
x_pred = fitted_model.forecast_quantiles(X_test)
|
||||||
# Remove featurized columns.
|
|
||||||
x_pred = x_pred[columns]
|
|
||||||
x_pred.rename(
|
|
||||||
{constants.TimeSeriesInternal.DUMMY_TARGET_COLUMN: "predicted_level"},
|
|
||||||
axis=1,
|
|
||||||
inplace=True,
|
|
||||||
)
|
|
||||||
x_pred["actual_level"] = y_test
|
x_pred["actual_level"] = y_test
|
||||||
x_pred["backtest_iteration"] = f"iteration_{last_training_date}"
|
x_pred["backtest_iteration"] = f"iteration_{last_training_date}"
|
||||||
|
x_pred.rename({0.5: "predicted_level"}, axis=1, inplace=True)
|
||||||
date_safe = RE_INVALID_SYMBOLS.sub("_", last_training_date)
|
date_safe = RE_INVALID_SYMBOLS.sub("_", last_training_date)
|
||||||
|
|
||||||
x_pred.to_csv(os.path.join(output_dir, f"iteration_{date_safe}.csv"), index=False)
|
x_pred.to_csv(os.path.join(output_dir, f"iteration_{date_safe}.csv"), index=False)
|
||||||
return x_pred
|
return x_pred
|
||||||
|
|
||||||
|
|||||||
@@ -365,6 +365,7 @@
|
|||||||
" step_size=BACKTESTING_PERIOD,\n",
|
" step_size=BACKTESTING_PERIOD,\n",
|
||||||
" step_number=NUMBER_OF_BACKTESTS,\n",
|
" step_number=NUMBER_OF_BACKTESTS,\n",
|
||||||
" model_uid=model_uid,\n",
|
" model_uid=model_uid,\n",
|
||||||
|
" forecast_quantiles=[0.025, 0.975], # Optional\n",
|
||||||
")"
|
")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -590,6 +591,7 @@
|
|||||||
" step_size=BACKTESTING_PERIOD,\n",
|
" step_size=BACKTESTING_PERIOD,\n",
|
||||||
" step_number=NUMBER_OF_BACKTESTS,\n",
|
" step_number=NUMBER_OF_BACKTESTS,\n",
|
||||||
" model_name=model_name,\n",
|
" model_name=model_name,\n",
|
||||||
|
" forecast_quantiles=[0.025, 0.975],\n",
|
||||||
")"
|
")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -700,9 +702,9 @@
|
|||||||
"Azure ML AutoML"
|
"Azure ML AutoML"
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ def get_backtest_pipeline(
|
|||||||
step_number: int,
|
step_number: int,
|
||||||
model_name: Optional[str] = None,
|
model_name: Optional[str] = None,
|
||||||
model_uid: Optional[str] = None,
|
model_uid: Optional[str] = None,
|
||||||
|
forecast_quantiles: Optional[list] = None,
|
||||||
) -> Pipeline:
|
) -> Pipeline:
|
||||||
"""
|
"""
|
||||||
:param experiment: The experiment used to run the pipeline.
|
:param experiment: The experiment used to run the pipeline.
|
||||||
@@ -44,6 +45,7 @@ def get_backtest_pipeline(
|
|||||||
:param step_size: The number of periods to step back in backtesting.
|
:param step_size: The number of periods to step back in backtesting.
|
||||||
:param step_number: The number of backtesting iterations.
|
:param step_number: The number of backtesting iterations.
|
||||||
:param model_uid: The uid to mark models from this run of the experiment.
|
:param model_uid: The uid to mark models from this run of the experiment.
|
||||||
|
:param forecast_quantiles: The forecast quantiles that are required in the inference.
|
||||||
:return: The pipeline to be used for model retraining.
|
:return: The pipeline to be used for model retraining.
|
||||||
**Note:** The output will be uploaded in the pipeline output
|
**Note:** The output will be uploaded in the pipeline output
|
||||||
called 'score'.
|
called 'score'.
|
||||||
@@ -135,6 +137,9 @@ def get_backtest_pipeline(
|
|||||||
if model_uid is not None:
|
if model_uid is not None:
|
||||||
prs_args.append("--model-uid")
|
prs_args.append("--model-uid")
|
||||||
prs_args.append(model_uid)
|
prs_args.append(model_uid)
|
||||||
|
if forecast_quantiles:
|
||||||
|
prs_args.append("--forecast_quantiles")
|
||||||
|
prs_args.extend(forecast_quantiles)
|
||||||
backtest_prs = ParallelRunStep(
|
backtest_prs = ParallelRunStep(
|
||||||
name=parallel_step_name,
|
name=parallel_step_name,
|
||||||
parallel_run_config=back_test_config,
|
parallel_run_config=back_test_config,
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"AutoML highlights here include built-in holiday featurization, accessing engineered feature names, and working with the `forecast` function. Please also look at the additional forecasting notebooks, which document lagging, rolling windows, forecast quantiles, other ways to use the forecast function, and forecaster deployment.\n",
|
"AutoML highlights here include built-in holiday featurization, accessing engineered feature names, and working with the `forecast` function. Please also look at the additional forecasting notebooks, which document lagging, rolling windows, forecast quantiles, other ways to use the forecast function, and forecaster deployment.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Make sure you have executed the [configuration notebook](../../../configuration.ipynb) before running this notebook.\n",
|
"Make sure you have executed the [configuration notebook](https://github.com/Azure/MachineLearningNotebooks/blob/master/configuration.ipynb) before running this notebook.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Notebook synopsis:\n",
|
"Notebook synopsis:\n",
|
||||||
"1. Creating an Experiment in an existing Workspace\n",
|
"1. Creating an Experiment in an existing Workspace\n",
|
||||||
@@ -575,7 +575,32 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"remote_run.download_file(\"outputs/predictions.csv\", \"predictions.csv\")\n",
|
"remote_run.download_file(\"outputs/predictions.csv\", \"predictions.csv\")\n",
|
||||||
"df_all = pd.read_csv(\"predictions.csv\")"
|
"fcst_df = pd.read_csv(\"predictions.csv\")"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"Note that the rolling forecast can contain multiple predictions for each date, each from a different forecast origin. For example, consider 2012-09-05:"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"fcst_df[fcst_df.date == \"2012-09-05\"]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"Here, the forecast origin refers to the latest date of actuals available for a given forecast. The earliest origin in the rolling forecast, 2012-08-31, is the last day in the training data. For origin date 2012-09-01, the forecasts use actual recorded counts from the training data *and* the actual count recorded on 2012-09-01. Note that the model is not retrained for origin dates later than 2012-08-31, but the values for model features, such as lagged values of daily count, are updated.\n",
|
||||||
|
"\n",
|
||||||
|
"Let's calculate the metrics over all rolling forecasts:"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -587,29 +612,17 @@
|
|||||||
"from azureml.automl.core.shared import constants\n",
|
"from azureml.automl.core.shared import constants\n",
|
||||||
"from azureml.automl.runtime.shared.score import scoring\n",
|
"from azureml.automl.runtime.shared.score import scoring\n",
|
||||||
"from sklearn.metrics import mean_absolute_error, mean_squared_error\n",
|
"from sklearn.metrics import mean_absolute_error, mean_squared_error\n",
|
||||||
"from matplotlib import pyplot as plt\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"# use automl metrics module\n",
|
"# use automl metrics module\n",
|
||||||
"scores = scoring.score_regression(\n",
|
"scores = scoring.score_regression(\n",
|
||||||
" y_test=df_all[target_column_name],\n",
|
" y_test=fcst_df[target_column_name],\n",
|
||||||
" y_pred=df_all[\"predicted\"],\n",
|
" y_pred=fcst_df[\"predicted\"],\n",
|
||||||
" metrics=list(constants.Metric.SCALAR_REGRESSION_SET),\n",
|
" metrics=list(constants.Metric.SCALAR_REGRESSION_SET),\n",
|
||||||
")\n",
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print(\"[Test data scores]\\n\")\n",
|
"print(\"[Test data scores]\\n\")\n",
|
||||||
"for key, value in scores.items():\n",
|
"for key, value in scores.items():\n",
|
||||||
" print(\"{}: {:.3f}\".format(key, value))\n",
|
" print(\"{}: {:.3f}\".format(key, value))"
|
||||||
"\n",
|
|
||||||
"# Plot outputs\n",
|
|
||||||
"%matplotlib inline\n",
|
|
||||||
"test_pred = plt.scatter(df_all[target_column_name], df_all[\"predicted\"], color=\"b\")\n",
|
|
||||||
"test_test = plt.scatter(\n",
|
|
||||||
" df_all[target_column_name], df_all[target_column_name], color=\"g\"\n",
|
|
||||||
")\n",
|
|
||||||
"plt.legend(\n",
|
|
||||||
" (test_pred, test_test), (\"prediction\", \"truth\"), loc=\"upper left\", fontsize=8\n",
|
|
||||||
")\n",
|
|
||||||
"plt.show()"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -618,36 +631,15 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"For more details on what metrics are included and how they are calculated, please refer to [supported metrics](https://docs.microsoft.com/en-us/azure/machine-learning/how-to-understand-automated-ml#regressionforecasting-metrics). You could also calculate residuals, like described [here](https://docs.microsoft.com/en-us/azure/machine-learning/how-to-understand-automated-ml#residuals).\n",
|
"For more details on what metrics are included and how they are calculated, please refer to [supported metrics](https://docs.microsoft.com/en-us/azure/machine-learning/how-to-understand-automated-ml#regressionforecasting-metrics). You could also calculate residuals, like described [here](https://docs.microsoft.com/en-us/azure/machine-learning/how-to-understand-automated-ml#residuals).\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"The rolling forecast metric values are very high in comparison to the validation metrics reported by the AutoML job. What's going on here? We will investigate in the following cells!"
|
||||||
"Since we did a rolling evaluation on the test set, we can analyze the predictions by their forecast horizon relative to the rolling origin. The model was initially trained at a forecast horizon of 14, so each prediction from the model is associated with a horizon value from 1 to 14. The horizon values are in a column named, \"horizon_origin,\" in the prediction set. For example, we can calculate some of the error metrics grouped by the horizon:"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"from metrics_helper import MAPE, APE\n",
|
|
||||||
"\n",
|
|
||||||
"df_all.groupby(\"horizon_origin\").apply(\n",
|
|
||||||
" lambda df: pd.Series(\n",
|
|
||||||
" {\n",
|
|
||||||
" \"MAPE\": MAPE(df[target_column_name], df[\"predicted\"]),\n",
|
|
||||||
" \"RMSE\": np.sqrt(\n",
|
|
||||||
" mean_squared_error(df[target_column_name], df[\"predicted\"])\n",
|
|
||||||
" ),\n",
|
|
||||||
" \"MAE\": mean_absolute_error(df[target_column_name], df[\"predicted\"]),\n",
|
|
||||||
" }\n",
|
|
||||||
" )\n",
|
|
||||||
")"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"To drill down more, we can look at the distributions of APE (absolute percentage error) by horizon. From the chart, it is clear that the overall MAPE is being skewed by one particular point where the actual value is of small absolute value."
|
"### Forecast versus actuals plot\n",
|
||||||
|
"We will plot predictions and actuals on a time series plot. Since there are many forecasts for each date, we select the 14-day-ahead forecast from each forecast origin for our comparison."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -656,21 +648,55 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"df_all_APE = df_all.assign(APE=APE(df_all[target_column_name], df_all[\"predicted\"]))\n",
|
"from matplotlib import pyplot as plt\n",
|
||||||
"APEs = [\n",
|
|
||||||
" df_all_APE[df_all[\"horizon_origin\"] == h].APE.values\n",
|
|
||||||
" for h in range(1, forecast_horizon + 1)\n",
|
|
||||||
"]\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"%matplotlib inline\n",
|
"%matplotlib inline\n",
|
||||||
"plt.boxplot(APEs)\n",
|
|
||||||
"plt.yscale(\"log\")\n",
|
|
||||||
"plt.xlabel(\"horizon\")\n",
|
|
||||||
"plt.ylabel(\"APE (%)\")\n",
|
|
||||||
"plt.title(\"Absolute Percentage Errors by Forecast Horizon\")\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
|
"fcst_df_h14 = (\n",
|
||||||
|
" fcst_df.groupby(\"forecast_origin\", as_index=False)\n",
|
||||||
|
" .last()\n",
|
||||||
|
" .drop(columns=[\"forecast_origin\"])\n",
|
||||||
|
")\n",
|
||||||
|
"fcst_df_h14.set_index(time_column_name, inplace=True)\n",
|
||||||
|
"plt.plot(fcst_df_h14[[target_column_name, \"predicted\"]])\n",
|
||||||
|
"plt.xticks(rotation=45)\n",
|
||||||
|
"plt.title(f\"Predicted vs. Actuals\")\n",
|
||||||
|
"plt.legend([\"actual\", \"14-day-ahead forecast\"])\n",
|
||||||
"plt.show()"
|
"plt.show()"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"Looking at the plot, there are two clear issues:\n",
|
||||||
|
"1. An anomalously low count value on October 29th, 2012.\n",
|
||||||
|
"2. End-of-year holidays (Thanksgiving and Christmas) in late November and late December.\n",
|
||||||
|
"\n",
|
||||||
|
"What happened on Oct. 29th, 2012? That day, Hurricane Sandy brought severe storm surge flooding to the east coast of the United States, particularly around New York City. This is certainly an anomalous event that the model did not account for!\n",
|
||||||
|
"\n",
|
||||||
|
"As for the late year holidays, the model apparently did not learn to account for the full reduction of bike share rentals on these major holidays. The training data covers 2011 and early 2012, so the model fit only had access to a single occurrence of these holidays. This makes it challenging to resolve holiday effects; however, a larger AutoML model search may result in a better model that is more holiday-aware.\n",
|
||||||
|
"\n",
|
||||||
|
"If we filter the predictions prior to the Thanksgiving holiday and remove the anomalous day of 2012-10-29, the metrics are closer to validation levels:"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"date_filter = (fcst_df.date != \"2012-10-29\") & (fcst_df.date < \"2012-11-22\")\n",
|
||||||
|
"scores = scoring.score_regression(\n",
|
||||||
|
" y_test=fcst_df[date_filter][target_column_name],\n",
|
||||||
|
" y_pred=fcst_df[date_filter][\"predicted\"],\n",
|
||||||
|
" metrics=list(constants.Metric.SCALAR_REGRESSION_SET),\n",
|
||||||
|
")\n",
|
||||||
|
"\n",
|
||||||
|
"print(\"[Test data scores (filtered)]\\n\")\n",
|
||||||
|
"for key, value in scores.items():\n",
|
||||||
|
" print(\"{}: {:.3f}\".format(key, value))"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
@@ -697,9 +723,9 @@
|
|||||||
"friendly_name": "Forecasting BikeShare Demand",
|
"friendly_name": "Forecasting BikeShare Demand",
|
||||||
"index_order": 1,
|
"index_order": 1,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
@@ -711,7 +737,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.8.5"
|
"version": "3.7.13"
|
||||||
},
|
},
|
||||||
"mimetype": "text/x-python",
|
"mimetype": "text/x-python",
|
||||||
"name": "python",
|
"name": "python",
|
||||||
|
|||||||
@@ -36,18 +36,18 @@ y_test_df = (
|
|||||||
|
|
||||||
fitted_model = joblib.load("model.pkl")
|
fitted_model = joblib.load("model.pkl")
|
||||||
|
|
||||||
y_pred, X_trans = fitted_model.rolling_evaluation(X_test_df, y_test_df.values)
|
X_rf = fitted_model.rolling_forecast(X_test_df, y_test_df.values, step=1)
|
||||||
|
|
||||||
# Add predictions, actuals, and horizon relative to rolling origin to the test feature data
|
# Add predictions, actuals, and horizon relative to rolling origin to the test feature data
|
||||||
assign_dict = {
|
assign_dict = {
|
||||||
"horizon_origin": X_trans["horizon_origin"].values,
|
fitted_model.forecast_origin_column_name: "forecast_origin",
|
||||||
"predicted": y_pred,
|
fitted_model.forecast_column_name: "predicted",
|
||||||
target_column_name: y_test_df[target_column_name].values,
|
fitted_model.actual_column_name: target_column_name,
|
||||||
}
|
}
|
||||||
df_all = X_test_df.assign(**assign_dict)
|
X_rf.rename(columns=assign_dict, inplace=True)
|
||||||
|
|
||||||
file_name = "outputs/predictions.csv"
|
file_name = "outputs/predictions.csv"
|
||||||
export_csv = df_all.to_csv(file_name, header=True)
|
export_csv = X_rf.to_csv(file_name, header=True)
|
||||||
|
|
||||||
# Upload the predictions into artifacts
|
# Upload the predictions into artifacts
|
||||||
run.upload_file(name=file_name, path_or_stream=file_name)
|
run.upload_file(name=file_name, path_or_stream=file_name)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"In this example we use the associated New York City energy demand dataset to showcase how you can use AutoML for a simple forecasting problem and explore the results. The goal is predict the energy demand for the next 48 hours based on historic time-series data.\n",
|
"In this example we use the associated New York City energy demand dataset to showcase how you can use AutoML for a simple forecasting problem and explore the results. The goal is predict the energy demand for the next 48 hours based on historic time-series data.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"If you are using an Azure Machine Learning Compute Instance, you are all set. Otherwise, go through the [configuration notebook](../../../configuration.ipynb) first, if you haven't already, to establish your connection to the AzureML Workspace.\n",
|
"If you are using an Azure Machine Learning Compute Instance, you are all set. Otherwise, go through the [configuration notebook](https://github.com/Azure/MachineLearningNotebooks/blob/master/configuration.ipynb) first, if you haven't already, to establish your connection to the AzureML Workspace.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"In this notebook you will learn how to:\n",
|
"In this notebook you will learn how to:\n",
|
||||||
"1. Creating an Experiment using an existing Workspace\n",
|
"1. Creating an Experiment using an existing Workspace\n",
|
||||||
@@ -767,9 +767,9 @@
|
|||||||
"automated-machine-learning"
|
"automated-machine-learning"
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"Please make sure you have followed the `configuration.ipynb` notebook so that your ML workspace information is saved in the config file."
|
"Please make sure you have followed the [configuration notebook](https://github.com/Azure/MachineLearningNotebooks/blob/master/configuration.ipynb) so that your ML workspace information is saved in the config file."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -758,7 +758,15 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"## Forecasting farther than the forecast horizon <a id=\"recursive forecasting\"></a>\n",
|
"## Forecasting farther than the forecast horizon <a id=\"recursive forecasting\"></a>\n",
|
||||||
"When the forecast destination, or the latest date in the prediction data frame, is farther into the future than the specified forecast horizon, the `forecast()` function will still make point predictions out to the later date using a recursive operation mode. Internally, the method recursively applies the regular forecaster to generate context so that we can forecast further into the future. \n",
|
"When the forecast destination, or the latest date in the prediction data frame, is farther into the future than the specified forecast horizon, the forecaster must be iteratively applied. Here, we advance the forecast origin on each iteration over the prediction window, predicting `max_horizon` periods ahead on each iteration. There are two choices for the context data to use as the forecaster advances into the prediction window:\n",
|
||||||
|
"\n",
|
||||||
|
"1. We can use forecasted values from previous iterations (recursive forecast),\n",
|
||||||
|
"2. We can use known, actual values of the target if they are available (rolling forecast).\n",
|
||||||
|
"\n",
|
||||||
|
"The first method is useful in a true forecasting scenario when we do not yet know the actual target values while the second is useful in an evaluation scenario where we want to compute accuracy metrics for the `max_horizon`-period-ahead forecaster over a long test set. We refer to the first as a **recursive forecast** since we apply the forecaster recursively over the prediction window and the second as a **rolling forecast** since we roll forward over known actuals.\n",
|
||||||
|
"\n",
|
||||||
|
"### Recursive forecasting\n",
|
||||||
|
"By default, the `forecast()` function will make point predictions out to the later date using a recursive operation mode. Internally, the method recursively applies the regular forecaster to generate context so that we can forecast further into the future. \n",
|
||||||
"\n",
|
"\n",
|
||||||
"To illustrate the use-case and operation of recursive forecasting, we'll consider an example with a single time-series where the forecasting period directly follows the training period and is twice as long as the forecasting horizon given at training time.\n",
|
"To illustrate the use-case and operation of recursive forecasting, we'll consider an example with a single time-series where the forecasting period directly follows the training period and is twice as long as the forecasting horizon given at training time.\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -818,6 +826,35 @@
|
|||||||
"np.array_equal(y_pred_all, y_pred_long)"
|
"np.array_equal(y_pred_all, y_pred_long)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### Rolling forecasts\n",
|
||||||
|
"A rolling forecast is a similar concept to the recursive forecasts described above except that we use known actual values of the target for our context data. We have provided a different, public method for this called `rolling_forecast`. In addition to test data and actuals (`X_test` and `y_test`), `rolling_forecast` also accepts an optional `step` parameter that controls how far the origin advances on each iteration. The recursive forecast mode uses a fixed step of `max_horizon` while `rolling_forecast` defaults to a step size of 1, but can be set to any integer from 1 to `max_horizon`, inclusive.\n",
|
||||||
|
"\n",
|
||||||
|
"Let's see what the rolling forecast looks like on the long test set with the step set to 1:"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"X_rf = fitted_model.rolling_forecast(X_test_long, y_test_long, step=1)\n",
|
||||||
|
"X_rf.head(n=12)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"Notice that `rolling_forecast` has returned a single DataFrame containing all results and has generated some new columns: `_automl_forecast_origin`, `_automl_forecast_y`, and `_automl_actual_y`. These are the origin date for each forecast, the forecasted value and the actual value, respectively. Note that \"y\" in the forecast and actual column names will generally be replaced by the target column name supplied to AutoML.\n",
|
||||||
|
"\n",
|
||||||
|
"The output above shows forecasts for two prediction windows, the first with origin at the end of the training set and the second including the first observation in the test set (2000-01-01 06:00:00). Since the forecast windows overlap, there are multiple forecasts for most dates which are associated with different origin dates."
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@@ -866,9 +903,9 @@
|
|||||||
"friendly_name": "Forecasting away from training data",
|
"friendly_name": "Forecasting away from training data",
|
||||||
"index_order": 3,
|
"index_order": 3,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
@@ -880,7 +917,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.8.5"
|
"version": "3.7.13"
|
||||||
},
|
},
|
||||||
"tags": [
|
"tags": [
|
||||||
"Forecasting",
|
"Forecasting",
|
||||||
@@ -894,5 +931,5 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
"nbformat_minor": 2
|
"nbformat_minor": 4
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"AutoML highlights here include using Deep Learning forecasts, Arima, Prophet, Remote Execution and Remote Inferencing, and working with the `forecast` function. Please also look at the additional forecasting notebooks, which document lagging, rolling windows, forecast quantiles, other ways to use the forecast function, and forecaster deployment.\n",
|
"AutoML highlights here include using Deep Learning forecasts, Arima, Prophet, Remote Execution and Remote Inferencing, and working with the `forecast` function. Please also look at the additional forecasting notebooks, which document lagging, rolling windows, forecast quantiles, other ways to use the forecast function, and forecaster deployment.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Make sure you have executed the [configuration](../../../configuration.ipynb) before running this notebook.\n",
|
"Make sure you have executed the [configuration](https://github.com/Azure/MachineLearningNotebooks/blob/master/configuration.ipynb) before running this notebook.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Notebook synopsis:\n",
|
"Notebook synopsis:\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -325,7 +325,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"### Setting forecaster maximum horizon \n",
|
"### Setting forecaster maximum horizon \n",
|
||||||
"\n",
|
"\n",
|
||||||
"The forecast horizon is the number of periods into the future that the model should predict. Here, we set the horizon to 12 periods (i.e. 12 months). Notice that this is much shorter than the number of months in the test set; we will need to use a rolling test to evaluate the performance on the whole test set. For more discussion of forecast horizons and guiding principles for setting them, please see the [energy demand notebook](https://github.com/Azure/MachineLearningNotebooks/tree/master/how-to-use-azureml/automated-machine-learning/forecasting-energy-demand). "
|
"The forecast horizon is the number of periods into the future that the model should predict. Here, we set the horizon to 14 periods (i.e. 14 days). Notice that this is much shorter than the number of months in the test set; we will need to use a rolling test to evaluate the performance on the whole test set. For more discussion of forecast horizons and guiding principles for setting them, please see the [energy demand notebook](https://github.com/Azure/MachineLearningNotebooks/tree/master/how-to-use-azureml/automated-machine-learning/forecasting-energy-demand). "
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -337,7 +337,7 @@
|
|||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"forecast_horizon = 12"
|
"forecast_horizon = 14"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -681,9 +681,9 @@
|
|||||||
],
|
],
|
||||||
"hide_code_all_hidden": false,
|
"hide_code_all_hidden": false,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
@@ -699,5 +699,5 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
"nbformat_minor": 2
|
"nbformat_minor": 4
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,6 @@ import os
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
from pandas.tseries.frequencies import to_offset
|
|
||||||
from sklearn.externals import joblib
|
from sklearn.externals import joblib
|
||||||
from sklearn.metrics import mean_absolute_error, mean_squared_error
|
from sklearn.metrics import mean_absolute_error, mean_squared_error
|
||||||
|
|
||||||
@@ -19,219 +18,8 @@ except ImportError:
|
|||||||
_torch_present = False
|
_torch_present = False
|
||||||
|
|
||||||
|
|
||||||
def align_outputs(
|
def map_location_cuda(storage, loc):
|
||||||
y_predicted,
|
return storage.cuda()
|
||||||
X_trans,
|
|
||||||
X_test,
|
|
||||||
y_test,
|
|
||||||
predicted_column_name="predicted",
|
|
||||||
horizon_colname="horizon_origin",
|
|
||||||
):
|
|
||||||
"""
|
|
||||||
Demonstrates how to get the output aligned to the inputs
|
|
||||||
using pandas indexes. Helps understand what happened if
|
|
||||||
the output's shape differs from the input shape, or if
|
|
||||||
the data got re-sorted by time and grain during forecasting.
|
|
||||||
|
|
||||||
Typical causes of misalignment are:
|
|
||||||
* we predicted some periods that were missing in actuals -> drop from eval
|
|
||||||
* model was asked to predict past max_horizon -> increase max horizon
|
|
||||||
* data at start of X_test was needed for lags -> provide previous periods
|
|
||||||
"""
|
|
||||||
if horizon_colname in X_trans:
|
|
||||||
df_fcst = pd.DataFrame(
|
|
||||||
{
|
|
||||||
predicted_column_name: y_predicted,
|
|
||||||
horizon_colname: X_trans[horizon_colname],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
df_fcst = pd.DataFrame({predicted_column_name: y_predicted})
|
|
||||||
|
|
||||||
# y and X outputs are aligned by forecast() function contract
|
|
||||||
df_fcst.index = X_trans.index
|
|
||||||
|
|
||||||
# align original X_test to y_test
|
|
||||||
X_test_full = X_test.copy()
|
|
||||||
X_test_full[target_column_name] = y_test
|
|
||||||
|
|
||||||
# X_test_full's index does not include origin, so reset for merge
|
|
||||||
df_fcst.reset_index(inplace=True)
|
|
||||||
X_test_full = X_test_full.reset_index().drop(columns="index")
|
|
||||||
together = df_fcst.merge(X_test_full, how="right")
|
|
||||||
|
|
||||||
# drop rows where prediction or actuals are nan
|
|
||||||
# happens because of missing actuals
|
|
||||||
# or at edges of time due to lags/rolling windows
|
|
||||||
clean = together[
|
|
||||||
together[[target_column_name, predicted_column_name]].notnull().all(axis=1)
|
|
||||||
]
|
|
||||||
return clean
|
|
||||||
|
|
||||||
|
|
||||||
def do_rolling_forecast_with_lookback(
|
|
||||||
fitted_model, X_test, y_test, max_horizon, X_lookback, y_lookback, freq="D"
|
|
||||||
):
|
|
||||||
"""
|
|
||||||
Produce forecasts on a rolling origin over the given test set.
|
|
||||||
|
|
||||||
Each iteration makes a forecast for the next 'max_horizon' periods
|
|
||||||
with respect to the current origin, then advances the origin by the
|
|
||||||
horizon time duration. The prediction context for each forecast is set so
|
|
||||||
that the forecaster uses the actual target values prior to the current
|
|
||||||
origin time for constructing lag features.
|
|
||||||
|
|
||||||
This function returns a concatenated DataFrame of rolling forecasts.
|
|
||||||
"""
|
|
||||||
print("Using lookback of size: ", y_lookback.size)
|
|
||||||
df_list = []
|
|
||||||
origin_time = X_test[time_column_name].min()
|
|
||||||
X = X_lookback.append(X_test)
|
|
||||||
y = np.concatenate((y_lookback, y_test), axis=0)
|
|
||||||
while origin_time <= X_test[time_column_name].max():
|
|
||||||
# Set the horizon time - end date of the forecast
|
|
||||||
horizon_time = origin_time + max_horizon * to_offset(freq)
|
|
||||||
|
|
||||||
# Extract test data from an expanding window up-to the horizon
|
|
||||||
expand_wind = X[time_column_name] < horizon_time
|
|
||||||
X_test_expand = X[expand_wind]
|
|
||||||
y_query_expand = np.zeros(len(X_test_expand)).astype(float)
|
|
||||||
y_query_expand.fill(np.NaN)
|
|
||||||
|
|
||||||
if origin_time != X[time_column_name].min():
|
|
||||||
# Set the context by including actuals up-to the origin time
|
|
||||||
test_context_expand_wind = X[time_column_name] < origin_time
|
|
||||||
context_expand_wind = X_test_expand[time_column_name] < origin_time
|
|
||||||
y_query_expand[context_expand_wind] = y[test_context_expand_wind]
|
|
||||||
|
|
||||||
# Print some debug info
|
|
||||||
print(
|
|
||||||
"Horizon_time:",
|
|
||||||
horizon_time,
|
|
||||||
" origin_time: ",
|
|
||||||
origin_time,
|
|
||||||
" max_horizon: ",
|
|
||||||
max_horizon,
|
|
||||||
" freq: ",
|
|
||||||
freq,
|
|
||||||
)
|
|
||||||
print("expand_wind: ", expand_wind)
|
|
||||||
print("y_query_expand")
|
|
||||||
print(y_query_expand)
|
|
||||||
print("X_test")
|
|
||||||
print(X)
|
|
||||||
print("X_test_expand")
|
|
||||||
print(X_test_expand)
|
|
||||||
print("Type of X_test_expand: ", type(X_test_expand))
|
|
||||||
print("Type of y_query_expand: ", type(y_query_expand))
|
|
||||||
|
|
||||||
print("y_query_expand")
|
|
||||||
print(y_query_expand)
|
|
||||||
|
|
||||||
# Make a forecast out to the maximum horizon
|
|
||||||
# y_fcst, X_trans = y_query_expand, X_test_expand
|
|
||||||
y_fcst, X_trans = fitted_model.forecast(X_test_expand, y_query_expand)
|
|
||||||
|
|
||||||
print("y_fcst")
|
|
||||||
print(y_fcst)
|
|
||||||
|
|
||||||
# Align forecast with test set for dates within
|
|
||||||
# the current rolling window
|
|
||||||
trans_tindex = X_trans.index.get_level_values(time_column_name)
|
|
||||||
trans_roll_wind = (trans_tindex >= origin_time) & (trans_tindex < horizon_time)
|
|
||||||
test_roll_wind = expand_wind & (X[time_column_name] >= origin_time)
|
|
||||||
df_list.append(
|
|
||||||
align_outputs(
|
|
||||||
y_fcst[trans_roll_wind],
|
|
||||||
X_trans[trans_roll_wind],
|
|
||||||
X[test_roll_wind],
|
|
||||||
y[test_roll_wind],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
# Advance the origin time
|
|
||||||
origin_time = horizon_time
|
|
||||||
|
|
||||||
return pd.concat(df_list, ignore_index=True)
|
|
||||||
|
|
||||||
|
|
||||||
def do_rolling_forecast(fitted_model, X_test, y_test, max_horizon, freq="D"):
|
|
||||||
"""
|
|
||||||
Produce forecasts on a rolling origin over the given test set.
|
|
||||||
|
|
||||||
Each iteration makes a forecast for the next 'max_horizon' periods
|
|
||||||
with respect to the current origin, then advances the origin by the
|
|
||||||
horizon time duration. The prediction context for each forecast is set so
|
|
||||||
that the forecaster uses the actual target values prior to the current
|
|
||||||
origin time for constructing lag features.
|
|
||||||
|
|
||||||
This function returns a concatenated DataFrame of rolling forecasts.
|
|
||||||
"""
|
|
||||||
df_list = []
|
|
||||||
origin_time = X_test[time_column_name].min()
|
|
||||||
while origin_time <= X_test[time_column_name].max():
|
|
||||||
# Set the horizon time - end date of the forecast
|
|
||||||
horizon_time = origin_time + max_horizon * to_offset(freq)
|
|
||||||
|
|
||||||
# Extract test data from an expanding window up-to the horizon
|
|
||||||
expand_wind = X_test[time_column_name] < horizon_time
|
|
||||||
X_test_expand = X_test[expand_wind]
|
|
||||||
y_query_expand = np.zeros(len(X_test_expand)).astype(float)
|
|
||||||
y_query_expand.fill(np.NaN)
|
|
||||||
|
|
||||||
if origin_time != X_test[time_column_name].min():
|
|
||||||
# Set the context by including actuals up-to the origin time
|
|
||||||
test_context_expand_wind = X_test[time_column_name] < origin_time
|
|
||||||
context_expand_wind = X_test_expand[time_column_name] < origin_time
|
|
||||||
y_query_expand[context_expand_wind] = y_test[test_context_expand_wind]
|
|
||||||
|
|
||||||
# Print some debug info
|
|
||||||
print(
|
|
||||||
"Horizon_time:",
|
|
||||||
horizon_time,
|
|
||||||
" origin_time: ",
|
|
||||||
origin_time,
|
|
||||||
" max_horizon: ",
|
|
||||||
max_horizon,
|
|
||||||
" freq: ",
|
|
||||||
freq,
|
|
||||||
)
|
|
||||||
print("expand_wind: ", expand_wind)
|
|
||||||
print("y_query_expand")
|
|
||||||
print(y_query_expand)
|
|
||||||
print("X_test")
|
|
||||||
print(X_test)
|
|
||||||
print("X_test_expand")
|
|
||||||
print(X_test_expand)
|
|
||||||
print("Type of X_test_expand: ", type(X_test_expand))
|
|
||||||
print("Type of y_query_expand: ", type(y_query_expand))
|
|
||||||
print("y_query_expand")
|
|
||||||
print(y_query_expand)
|
|
||||||
|
|
||||||
# Make a forecast out to the maximum horizon
|
|
||||||
y_fcst, X_trans = fitted_model.forecast(X_test_expand, y_query_expand)
|
|
||||||
|
|
||||||
print("y_fcst")
|
|
||||||
print(y_fcst)
|
|
||||||
|
|
||||||
# Align forecast with test set for dates within the
|
|
||||||
# current rolling window
|
|
||||||
trans_tindex = X_trans.index.get_level_values(time_column_name)
|
|
||||||
trans_roll_wind = (trans_tindex >= origin_time) & (trans_tindex < horizon_time)
|
|
||||||
test_roll_wind = expand_wind & (X_test[time_column_name] >= origin_time)
|
|
||||||
df_list.append(
|
|
||||||
align_outputs(
|
|
||||||
y_fcst[trans_roll_wind],
|
|
||||||
X_trans[trans_roll_wind],
|
|
||||||
X_test[test_roll_wind],
|
|
||||||
y_test[test_roll_wind],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
# Advance the origin time
|
|
||||||
origin_time = horizon_time
|
|
||||||
|
|
||||||
return pd.concat(df_list, ignore_index=True)
|
|
||||||
|
|
||||||
|
|
||||||
def APE(actual, pred):
|
def APE(actual, pred):
|
||||||
@@ -254,10 +42,6 @@ def MAPE(actual, pred):
|
|||||||
return np.mean(APE(actual_safe, pred_safe))
|
return np.mean(APE(actual_safe, pred_safe))
|
||||||
|
|
||||||
|
|
||||||
def map_location_cuda(storage, loc):
|
|
||||||
return storage.cuda()
|
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--max_horizon",
|
"--max_horizon",
|
||||||
@@ -303,7 +87,6 @@ print(model_path)
|
|||||||
run = Run.get_context()
|
run = Run.get_context()
|
||||||
# get input dataset by name
|
# get input dataset by name
|
||||||
test_dataset = run.input_datasets["test_data"]
|
test_dataset = run.input_datasets["test_data"]
|
||||||
lookback_dataset = run.input_datasets["lookback_data"]
|
|
||||||
|
|
||||||
grain_column_names = []
|
grain_column_names = []
|
||||||
|
|
||||||
@@ -312,15 +95,8 @@ df = test_dataset.to_pandas_dataframe()
|
|||||||
print("Read df")
|
print("Read df")
|
||||||
print(df)
|
print(df)
|
||||||
|
|
||||||
X_test_df = test_dataset.drop_columns(columns=[target_column_name])
|
X_test_df = df
|
||||||
y_test_df = test_dataset.with_timestamp_columns(None).keep_columns(
|
y_test = df.pop(target_column_name).to_numpy()
|
||||||
columns=[target_column_name]
|
|
||||||
)
|
|
||||||
|
|
||||||
X_lookback_df = lookback_dataset.drop_columns(columns=[target_column_name])
|
|
||||||
y_lookback_df = lookback_dataset.with_timestamp_columns(None).keep_columns(
|
|
||||||
columns=[target_column_name]
|
|
||||||
)
|
|
||||||
|
|
||||||
_, ext = os.path.splitext(model_path)
|
_, ext = os.path.splitext(model_path)
|
||||||
if ext == ".pt":
|
if ext == ".pt":
|
||||||
@@ -336,37 +112,20 @@ else:
|
|||||||
# Load the sklearn pipeline.
|
# Load the sklearn pipeline.
|
||||||
fitted_model = joblib.load(model_path)
|
fitted_model = joblib.load(model_path)
|
||||||
|
|
||||||
if hasattr(fitted_model, "get_lookback"):
|
X_rf = fitted_model.rolling_forecast(X_test_df, y_test, step=1)
|
||||||
lookback = fitted_model.get_lookback()
|
assign_dict = {
|
||||||
df_all = do_rolling_forecast_with_lookback(
|
fitted_model.forecast_origin_column_name: "forecast_origin",
|
||||||
fitted_model,
|
fitted_model.forecast_column_name: "predicted",
|
||||||
X_test_df.to_pandas_dataframe(),
|
fitted_model.actual_column_name: target_column_name,
|
||||||
y_test_df.to_pandas_dataframe().values.T[0],
|
}
|
||||||
max_horizon,
|
X_rf.rename(columns=assign_dict, inplace=True)
|
||||||
X_lookback_df.to_pandas_dataframe()[-lookback:],
|
|
||||||
y_lookback_df.to_pandas_dataframe().values.T[0][-lookback:],
|
|
||||||
freq,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
df_all = do_rolling_forecast(
|
|
||||||
fitted_model,
|
|
||||||
X_test_df.to_pandas_dataframe(),
|
|
||||||
y_test_df.to_pandas_dataframe().values.T[0],
|
|
||||||
max_horizon,
|
|
||||||
freq,
|
|
||||||
)
|
|
||||||
|
|
||||||
print(df_all)
|
print(X_rf.head())
|
||||||
|
|
||||||
print("target values:::")
|
|
||||||
print(df_all[target_column_name])
|
|
||||||
print("predicted values:::")
|
|
||||||
print(df_all["predicted"])
|
|
||||||
|
|
||||||
# Use the AutoML scoring module
|
# Use the AutoML scoring module
|
||||||
regression_metrics = list(constants.REGRESSION_SCALAR_SET)
|
regression_metrics = list(constants.REGRESSION_SCALAR_SET)
|
||||||
y_test = np.array(df_all[target_column_name])
|
y_test = np.array(X_rf[target_column_name])
|
||||||
y_pred = np.array(df_all["predicted"])
|
y_pred = np.array(X_rf["predicted"])
|
||||||
scores = scoring.score_regression(y_test, y_pred, regression_metrics)
|
scores = scoring.score_regression(y_test, y_pred, regression_metrics)
|
||||||
|
|
||||||
print("scores:")
|
print("scores:")
|
||||||
@@ -376,11 +135,11 @@ for key, value in scores.items():
|
|||||||
run.log(key, value)
|
run.log(key, value)
|
||||||
|
|
||||||
print("Simple forecasting model")
|
print("Simple forecasting model")
|
||||||
rmse = np.sqrt(mean_squared_error(df_all[target_column_name], df_all["predicted"]))
|
rmse = np.sqrt(mean_squared_error(X_rf[target_column_name], X_rf["predicted"]))
|
||||||
print("[Test Data] \nRoot Mean squared error: %.2f" % rmse)
|
print("[Test Data] \nRoot Mean squared error: %.2f" % rmse)
|
||||||
mae = mean_absolute_error(df_all[target_column_name], df_all["predicted"])
|
mae = mean_absolute_error(X_rf[target_column_name], X_rf["predicted"])
|
||||||
print("mean_absolute_error score: %.2f" % mae)
|
print("mean_absolute_error score: %.2f" % mae)
|
||||||
print("MAPE: %.2f" % MAPE(df_all[target_column_name], df_all["predicted"]))
|
print("MAPE: %.2f" % MAPE(X_rf[target_column_name], X_rf["predicted"]))
|
||||||
|
|
||||||
run.log("rmse", rmse)
|
run.log("rmse", rmse)
|
||||||
run.log("mae", mae)
|
run.log("mae", mae)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"### Prerequisites\n",
|
"### Prerequisites\n",
|
||||||
"You'll need to create a compute Instance by following the instructions in the [EnvironmentSetup.md](../Setup_Resources/EnvironmentSetup.md)."
|
"You'll need to create a compute Instance by following [these](https://learn.microsoft.com/en-us/azure/machine-learning/v1/how-to-create-manage-compute-instance?tabs=python) instructions."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -251,8 +251,17 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"### Set up training parameters\n",
|
"### Set up training parameters\n",
|
||||||
"\n",
|
"\n",
|
||||||
"This dictionary defines the AutoML and hierarchy settings. For this forecasting task we need to define several settings inncluding the name of the time column, the maximum forecast horizon, the hierarchy definition, and the level of the hierarchy at which to train.\n",
|
"We need to provide ``ForecastingParameters``, ``AutoMLConfig`` and ``HTSTrainParameters`` objects. For the forecasting task we need to define several settings including the name of the time column, the maximum forecast horizon, the hierarchy definition, and the level of the hierarchy at which to train.\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
"#### ``ForecastingParameters`` arguments\n",
|
||||||
|
"| Property | Description|\n",
|
||||||
|
"| :--------------- | :------------------- |\n",
|
||||||
|
"| **forecast_horizon** | The forecast horizon is how many periods forward you would like to forecast. This integer horizon is in units of the timeseries frequency (e.g. daily, weekly). Periods are inferred from your data. |\n",
|
||||||
|
"| **time_column_name** | The name of your time column. |\n",
|
||||||
|
"| **time_series_id_column_names** | The column names used to uniquely identify timeseries in data that has multiple rows with the same timestamp. |\n",
|
||||||
|
"| **cv_step_size** | Number of periods between two consecutive cross-validation folds. The default value is \\\"auto\\\", in which case AutoMl determines the cross-validation step size automatically, if a validation set is not provided. Or users could specify an integer value. |\n",
|
||||||
|
"\n",
|
||||||
|
"#### ``AutoMLConfig`` arguments\n",
|
||||||
"| Property | Description|\n",
|
"| Property | Description|\n",
|
||||||
"| :--------------- | :------------------- |\n",
|
"| :--------------- | :------------------- |\n",
|
||||||
"| **task** | forecasting |\n",
|
"| **task** | forecasting |\n",
|
||||||
@@ -260,20 +269,22 @@
|
|||||||
"| **blocked_models** | Blocked models won't be used by AutoML. |\n",
|
"| **blocked_models** | Blocked models won't be used by AutoML. |\n",
|
||||||
"| **iteration_timeout_minutes** | Maximum amount of time in minutes that the model can train. This is optional but provides customers with greater control on exit criteria. |\n",
|
"| **iteration_timeout_minutes** | Maximum amount of time in minutes that the model can train. This is optional but provides customers with greater control on exit criteria. |\n",
|
||||||
"| **iterations** | Number of models to train. This is optional but provides customers with greater control on exit criteria. |\n",
|
"| **iterations** | Number of models to train. This is optional but provides customers with greater control on exit criteria. |\n",
|
||||||
"| **experiment_timeout_hours** | Maximum amount of time in hours that the experiment can take before it terminates. This is optional but provides customers with greater control on exit criteria. |\n",
|
"| **experiment_timeout_hours** | Maximum amount of time in hours that each experiment can take before it terminates. This is optional but provides customers with greater control on exit criteria. **It does not control the overall timeout for the pipeline run, instead controls the timeout for each training run per partitioned time series.** |\n",
|
||||||
"| **label_column_name** | The name of the label column. |\n",
|
"| **label_column_name** | The name of the label column. |\n",
|
||||||
"| **forecast_horizon** | The forecast horizon is how many periods forward you would like to forecast. This integer horizon is in units of the timeseries frequency (e.g. daily, weekly). Periods are inferred from your data. |\n",
|
"| **n_cross_validations** | Number of cross validation splits. The default value is \\\"auto\\\", in which case AutoMl determines the number of cross-validations automatically, if a validation set is not provided. Or users could specify an integer value. Rolling Origin Validation is used to split time-series in a temporally consistent way. |\n",
|
||||||
"|**n_cross_validations**|Number of cross-validation folds to use for model/pipeline selection. The default value is \"auto\", in which case AutoMl determines the number of cross-validations automatically, if a validation set is not provided. Or users could specify an integer value.\n",
|
"| **enable_early_stopping** | Flag to enable early termination if the primary metric is no longer improving. |\n",
|
||||||
"|**cv_step_size**|Number of periods between two consecutive cross-validation folds. The default value is \"auto\", in which case AutoMl determines the cross-validation step size automatically, if a validation set is not provided. Or users could specify an integer value.\n",
|
|
||||||
"| **enable_early_stopping** | Flag to enable early termination if the score is not improving in the short term. |\n",
|
|
||||||
"| **time_column_name** | The name of your time column. |\n",
|
|
||||||
"| **hierarchy_column_names** | The names of columns that define the hierarchical structure of the data from highest level to most granular. |\n",
|
|
||||||
"| **training_level** | The level of the hierarchy to be used for training models. |\n",
|
|
||||||
"| **enable_engineered_explanations** | Engineered feature explanations will be downloaded if enable_engineered_explanations flag is set to True. By default it is set to False to save storage space. |\n",
|
"| **enable_engineered_explanations** | Engineered feature explanations will be downloaded if enable_engineered_explanations flag is set to True. By default it is set to False to save storage space. |\n",
|
||||||
"| **time_series_id_column_name** | The column names used to uniquely identify timeseries in data that has multiple rows with the same timestamp. |\n",
|
|
||||||
"| **track_child_runs** | Flag to disable tracking of child runs. Only best run is tracked if the flag is set to False (this includes the model and metrics of the run). |\n",
|
"| **track_child_runs** | Flag to disable tracking of child runs. Only best run is tracked if the flag is set to False (this includes the model and metrics of the run). |\n",
|
||||||
"| **pipeline_fetch_max_batch_size** | Determines how many pipelines (training algorithms) to fetch at a time for training, this helps reduce throttling when training at large scale. |\n",
|
"| **pipeline_fetch_max_batch_size** | Determines how many pipelines (training algorithms) to fetch at a time for training, this helps reduce throttling when training at large scale. |\n",
|
||||||
"| **model_explainability** | Flag to disable explaining the best automated ML model at the end of all training iterations. The default is True and will block non-explainable models which may impact the forecast accuracy. For more information, see [Interpretability: model explanations in automated machine learning](https://docs.microsoft.com/en-us/azure/machine-learning/how-to-machine-learning-interpretability-automl). |"
|
"| **model_explainability** | Flag to disable explaining the best automated ML model at the end of all training iterations. The default is True and will block non-explainable models which may impact the forecast accuracy. For more information, see [Interpretability: model explanations in automated machine learning](https://docs.microsoft.com/en-us/azure/machine-learning/how-to-machine-learning-interpretability-automl). |\n",
|
||||||
|
"\n",
|
||||||
|
"#### ``HTSTrainParameters`` arguments\n",
|
||||||
|
"| Property | Description|\n",
|
||||||
|
"| :--------------- | :------------------- |\n",
|
||||||
|
"| **automl_settings** | The ``AutoMLConfig`` object defined above. |\n",
|
||||||
|
"| **hierarchy_column_names** | The names of columns that define the hierarchical structure of the data from highest level to most granular. |\n",
|
||||||
|
"| **training_level** | The level of the hierarchy to be used for training models. |\n",
|
||||||
|
"| **enable_engineered_explanations** | The switch controls engineered explanations. |"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -287,6 +298,9 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"from azureml.train.automl.runtime._hts.hts_parameters import HTSTrainParameters\n",
|
"from azureml.train.automl.runtime._hts.hts_parameters import HTSTrainParameters\n",
|
||||||
|
"from azureml.automl.core.forecasting_parameters import ForecastingParameters\n",
|
||||||
|
"from azureml.train.automl.automlconfig import AutoMLConfig\n",
|
||||||
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"model_explainability = True\n",
|
"model_explainability = True\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -300,24 +314,26 @@
|
|||||||
"label_column_name = \"quantity\"\n",
|
"label_column_name = \"quantity\"\n",
|
||||||
"forecast_horizon = 7\n",
|
"forecast_horizon = 7\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
"forecasting_parameters = ForecastingParameters(\n",
|
||||||
|
" time_column_name=time_column_name,\n",
|
||||||
|
" forecast_horizon=forecast_horizon,\n",
|
||||||
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"automl_settings = {\n",
|
"automl_settings = AutoMLConfig(\n",
|
||||||
" \"task\": \"forecasting\",\n",
|
" task=\"forecasting\",\n",
|
||||||
" \"primary_metric\": \"normalized_root_mean_squared_error\",\n",
|
" primary_metric=\"normalized_root_mean_squared_error\",\n",
|
||||||
" \"label_column_name\": label_column_name,\n",
|
" experiment_timeout_hours=1,\n",
|
||||||
" \"time_column_name\": time_column_name,\n",
|
" label_column_name=label_column_name,\n",
|
||||||
" \"forecast_horizon\": forecast_horizon,\n",
|
" track_child_runs=False,\n",
|
||||||
" \"hierarchy_column_names\": hierarchy,\n",
|
" forecasting_parameters=forecasting_parameters,\n",
|
||||||
" \"hierarchy_training_level\": training_level,\n",
|
" pipeline_fetch_max_batch_size=15,\n",
|
||||||
" \"track_child_runs\": False,\n",
|
" model_explainability=model_explainability,\n",
|
||||||
" \"pipeline_fetch_max_batch_size\": 15,\n",
|
" n_cross_validations=\"auto\", # Feel free to set to a small integer (>=2) if runtime is an issue.\n",
|
||||||
" \"model_explainability\": model_explainability,\n",
|
" cv_step_size=\"auto\",\n",
|
||||||
" \"n_cross_validations\": \"auto\", # Feel free to set to a small integer (>=2) if runtime is an issue.\n",
|
|
||||||
" \"cv_step_size\": \"auto\",\n",
|
|
||||||
" # The following settings are specific to this sample and should be adjusted according to your own needs.\n",
|
" # The following settings are specific to this sample and should be adjusted according to your own needs.\n",
|
||||||
" \"iteration_timeout_minutes\": 10,\n",
|
" iteration_timeout_minutes=10,\n",
|
||||||
" \"iterations\": 10,\n",
|
" iterations=15,\n",
|
||||||
"}\n",
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"hts_parameters = HTSTrainParameters(\n",
|
"hts_parameters = HTSTrainParameters(\n",
|
||||||
" automl_settings=automl_settings,\n",
|
" automl_settings=automl_settings,\n",
|
||||||
@@ -338,15 +354,25 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"Parallel run step is leveraged to train the hierarchy. To configure the ParallelRunConfig you will need to determine the appropriate number of workers and nodes for your use case. The `process_count_per_node` is based off the number of cores of the compute VM. The node_count will determine the number of master nodes to use, increasing the node count will speed up the training process.\n",
|
"Parallel run step is leveraged to train multiple models at once. To configure the ParallelRunConfig you will need to determine the appropriate number of workers and nodes for your use case. The ``process_count_per_node`` is based off the number of cores of the compute VM. The node_count will determine the number of master nodes to use, increasing the node count will speed up the training process.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"* **experiment:** The experiment used for training.\n",
|
"| Property | Description|\n",
|
||||||
"* **train_data:** The tabular dataset to be used as input to the training run.\n",
|
"| :--------------- | :------------------- |\n",
|
||||||
"* **node_count:** The number of compute nodes to be used for running the user script. We recommend to start with 3 and increase the node_count if the training time is taking too long.\n",
|
"| **experiment** | The experiment used for training. |\n",
|
||||||
"* **process_count_per_node:** Process count per node, we recommend 2:1 ratio for number of cores: number of processes per node. eg. If node has 16 cores then configure 8 or less process count per node or optimal performance.\n",
|
"| **train_data** | The file dataset to be used as input to the training run. |\n",
|
||||||
"* **train_pipeline_parameters:** The set of configuration parameters defined in the previous section. \n",
|
"| **node_count** | The number of compute nodes to be used for running the user script. We recommend to start with 3 and increase the node_count if the training time is taking too long. |\n",
|
||||||
|
"| **process_count_per_node** | Process count per node, we recommend 2:1 ratio for number of cores: number of processes per node. eg. If node has 16 cores then configure 8 or less process count per node for optimal performance. |\n",
|
||||||
|
"| **train_pipeline_parameters** | The set of configuration parameters defined in the previous section. |\n",
|
||||||
|
"| **run_invocation_timeout** | Maximum amount of time in seconds that the ``ParallelRunStep`` class is allowed. This is optional but provides customers with greater control on exit criteria. This must be greater than ``experiment_timeout_hours`` by at least 300 seconds. |\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Calling this method will create a new aggregated dataset which is generated dynamically on pipeline execution."
|
"Calling this method will create a new aggregated dataset which is generated dynamically on pipeline execution.\n",
|
||||||
|
"\n",
|
||||||
|
"**Note**: Total time taken for the **training step** in the pipeline to complete = $ \\frac{t}{ p \\times n } \\times ts $\n",
|
||||||
|
"where,\n",
|
||||||
|
"- $ t $ is time taken for training one partition (can be viewed in the training logs)\n",
|
||||||
|
"- $ p $ is ``process_count_per_node``\n",
|
||||||
|
"- $ n $ is ``node_count``\n",
|
||||||
|
"- $ ts $ is total number of partitions in time series based on ``partition_column_names``"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -365,6 +391,7 @@
|
|||||||
" node_count=2,\n",
|
" node_count=2,\n",
|
||||||
" process_count_per_node=8,\n",
|
" process_count_per_node=8,\n",
|
||||||
" train_pipeline_parameters=hts_parameters,\n",
|
" train_pipeline_parameters=hts_parameters,\n",
|
||||||
|
" run_invocation_timeout=3900,\n",
|
||||||
")"
|
")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -509,19 +536,24 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"## 5.0 Forecasting\n",
|
"## 5.0 Forecasting\n",
|
||||||
"For hierarchical forecasting we need to provide the HTSInferenceParameters object.\n",
|
"For hierarchical forecasting we need to provide the HTSInferenceParameters object.\n",
|
||||||
"#### HTSInferenceParameters arguments\n",
|
"#### ``HTSInferenceParameters`` arguments\n",
|
||||||
"* **hierarchy_forecast_level:** The default level of the hierarchy to produce prediction/forecast on.\n",
|
"| Property | Description|\n",
|
||||||
"* **allocation_method:** \\[Optional] The disaggregation method to use if the hierarchy forecast level specified is below the define hierarchy training level. <br><i>(average historical proportions) 'average_historical_proportions'</i><br><i>(proportions of the historical averages) 'proportions_of_historical_average'</i>\n",
|
"| :--------------- | :------------------- |\n",
|
||||||
|
"| **hierarchy_forecast_level:** | The default level of the hierarchy to produce prediction/forecast on. |\n",
|
||||||
|
"| **allocation_method:** | \\[Optional] The disaggregation method to use if the hierarchy forecast level specified is below the define hierarchy training level. <br><i>(average historical proportions) 'average_historical_proportions'</i><br><i>(proportions of the historical averages) 'proportions_of_historical_average'</i> |\n",
|
||||||
"\n",
|
"\n",
|
||||||
"#### get_many_models_batch_inference_steps arguments\n",
|
"#### ``get_many_models_batch_inference_steps`` arguments\n",
|
||||||
"* **experiment:** The experiment used for inference run.\n",
|
"| Property | Description|\n",
|
||||||
"* **inference_data:** The data to use for inferencing. It should be the same schema as used for training.\n",
|
"| :--------------- | :------------------- |\n",
|
||||||
"* **compute_target:** The compute target that runs the inference pipeline.\n",
|
"| **experiment** | The experiment used for inference run. |\n",
|
||||||
"* **node_count:** The number of compute nodes to be used for running the user script. We recommend to start with the number of cores per node (varies by compute sku).\n",
|
"| **inference_data** | The data to use for inferencing. It should be the same schema as used for training.\n",
|
||||||
"* **process_count_per_node:** The number of processes per node.\n",
|
"| **compute_target** | The compute target that runs the inference pipeline. |\n",
|
||||||
"* **train_run_id:** \\[Optional] The run id of the hierarchy training, by default it is the latest successful training hts run in the experiment.\n",
|
"| **node_count** | The number of compute nodes to be used for running the user script. We recommend to start with the number of cores per node (varies by compute sku). |\n",
|
||||||
"* **train_experiment_name:** \\[Optional] The train experiment that contains the train pipeline. This one is only needed when the train pipeline is not in the same experiement as the inference pipeline.\n",
|
"| **process_count_per_node** | \\[Optional] The number of processes per node. By default it's 2 (should be at most half of the number of cores in a single node of the compute cluster that will be used for the experiment).\n",
|
||||||
"* **process_count_per_node:** \\[Optional] The number of processes per node, by default it's 4."
|
"| **inference_pipeline_parameters** | \\[Optional] The ``HTSInferenceParameters`` object defined above. |\n",
|
||||||
|
"| **train_run_id** | \\[Optional] The run id of the **training pipeline**. By default it is the latest successful training pipeline run in the experiment. |\n",
|
||||||
|
"| **train_experiment_name** | \\[Optional] The train experiment that contains the train pipeline. This one is only needed when the train pipeline is not in the same experiement as the inference pipeline. |\n",
|
||||||
|
"| **run_invocation_timeout** | \\[Optional] Maximum amount of time in seconds that the ``ParallelRunStep`` class is allowed. This is optional but provides customers with greater control on exit criteria. |"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -620,9 +652,9 @@
|
|||||||
"automated-machine-learning"
|
"automated-machine-learning"
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"### Prerequisites\n",
|
"### Prerequisites\n",
|
||||||
"You'll need to create a compute Instance by following the instructions in the [EnvironmentSetup.md](../Setup_Resources/EnvironmentSetup.md)."
|
"You'll need to create a compute Instance by following [these](https://learn.microsoft.com/en-us/azure/machine-learning/v1/how-to-create-manage-compute-instance?tabs=python) instructions."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -379,8 +379,17 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"### Set up training parameters\n",
|
"### Set up training parameters\n",
|
||||||
"\n",
|
"\n",
|
||||||
"This dictionary defines the AutoML and many models settings. For this forecasting task we need to define several settings inncluding the name of the time column, the maximum forecast horizon, and the partition column name definition.\n",
|
"We need to provide ``ForecastingParameters``, ``AutoMLConfig`` and ``ManyModelsTrainParameters`` objects. For the forecasting task we also need to define several settings including the name of the time column, the maximum forecast horizon, and the partition column name(s) definition.\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
"#### ``ForecastingParameters`` arguments\n",
|
||||||
|
"| Property | Description|\n",
|
||||||
|
"| :--------------- | :------------------- |\n",
|
||||||
|
"| **forecast_horizon** | The forecast horizon is how many periods forward you would like to forecast. This integer horizon is in units of the timeseries frequency (e.g. daily, weekly). Periods are inferred from your data. |\n",
|
||||||
|
"| **time_column_name** | The name of your time column. |\n",
|
||||||
|
"| **time_series_id_column_names** | The column names used to uniquely identify timeseries in data that has multiple rows with the same timestamp. |\n",
|
||||||
|
"| **cv_step_size** | Number of periods between two consecutive cross-validation folds. The default value is \\\"auto\\\", in which case AutoMl determines the cross-validation step size automatically, if a validation set is not provided. Or users could specify an integer value. |\n",
|
||||||
|
"\n",
|
||||||
|
"#### ``AutoMLConfig`` arguments\n",
|
||||||
"| Property | Description|\n",
|
"| Property | Description|\n",
|
||||||
"| :--------------- | :------------------- |\n",
|
"| :--------------- | :------------------- |\n",
|
||||||
"| **task** | forecasting |\n",
|
"| **task** | forecasting |\n",
|
||||||
@@ -388,17 +397,19 @@
|
|||||||
"| **blocked_models** | Blocked models won't be used by AutoML. |\n",
|
"| **blocked_models** | Blocked models won't be used by AutoML. |\n",
|
||||||
"| **iteration_timeout_minutes** | Maximum amount of time in minutes that the model can train. This is optional but provides customers with greater control on exit criteria. |\n",
|
"| **iteration_timeout_minutes** | Maximum amount of time in minutes that the model can train. This is optional but provides customers with greater control on exit criteria. |\n",
|
||||||
"| **iterations** | Number of models to train. This is optional but provides customers with greater control on exit criteria. |\n",
|
"| **iterations** | Number of models to train. This is optional but provides customers with greater control on exit criteria. |\n",
|
||||||
"| **experiment_timeout_hours** | Maximum amount of time in hours that the experiment can take before it terminates. This is optional but provides customers with greater control on exit criteria. |\n",
|
"| **experiment_timeout_hours** | Maximum amount of time in hours that each experiment can take before it terminates. This is optional but provides customers with greater control on exit criteria. **It does not control the overall timeout for the pipeline run, instead controls the timeout for each training run per partitioned time series.** |\n",
|
||||||
"| **label_column_name** | The name of the label column. |\n",
|
"| **label_column_name** | The name of the label column. |\n",
|
||||||
"| **forecast_horizon** | The forecast horizon is how many periods forward you would like to forecast. This integer horizon is in units of the timeseries frequency (e.g. daily, weekly). Periods are inferred from your data. |\n",
|
"| **n_cross_validations** | Number of cross validation splits. The default value is \\\"auto\\\", in which case AutoMl determines the number of cross-validations automatically, if a validation set is not provided. Or users could specify an integer value. Rolling Origin Validation is used to split time-series in a temporally consistent way. |\n",
|
||||||
"| **n_cross_validations** | Number of cross validation splits. The default value is \"auto\", in which case AutoMl determines the number of cross-validations automatically, if a validation set is not provided. Or users could specify an integer value. Rolling Origin Validation is used to split time-series in a temporally consistent way. |\n",
|
"| **enable_early_stopping** | Flag to enable early termination if the primary metric is no longer improving. |\n",
|
||||||
"|**cv_step_size**|Number of periods between two consecutive cross-validation folds. The default value is \"auto\", in which case AutoMl determines the cross-validation step size automatically, if a validation set is not provided. Or users could specify an integer value.\n",
|
|
||||||
"| **enable_early_stopping** | Flag to enable early termination if the score is not improving in the short term. |\n",
|
|
||||||
"| **time_column_name** | The name of your time column. |\n",
|
|
||||||
"| **enable_engineered_explanations** | Engineered feature explanations will be downloaded if enable_engineered_explanations flag is set to True. By default it is set to False to save storage space. |\n",
|
"| **enable_engineered_explanations** | Engineered feature explanations will be downloaded if enable_engineered_explanations flag is set to True. By default it is set to False to save storage space. |\n",
|
||||||
"| **time_series_id_column_names** | The column names used to uniquely identify timeseries in data that has multiple rows with the same timestamp. |\n",
|
|
||||||
"| **track_child_runs** | Flag to disable tracking of child runs. Only best run is tracked if the flag is set to False (this includes the model and metrics of the run). |\n",
|
"| **track_child_runs** | Flag to disable tracking of child runs. Only best run is tracked if the flag is set to False (this includes the model and metrics of the run). |\n",
|
||||||
"| **pipeline_fetch_max_batch_size** | Determines how many pipelines (training algorithms) to fetch at a time for training, this helps reduce throttling when training at large scale. |\n",
|
"| **pipeline_fetch_max_batch_size** | Determines how many pipelines (training algorithms) to fetch at a time for training, this helps reduce throttling when training at large scale. |\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"#### ``ManyModelsTrainParameters`` arguments\n",
|
||||||
|
"| Property | Description|\n",
|
||||||
|
"| :--------------- | :------------------- |\n",
|
||||||
|
"| **automl_settings** | The ``AutoMLConfig`` object defined above. |\n",
|
||||||
"| **partition_column_names** | The names of columns used to group your models. For timeseries, the groups must not split up individual time-series. That is, each group must contain one or more whole time-series. |"
|
"| **partition_column_names** | The names of columns used to group your models. For timeseries, the groups must not split up individual time-series. That is, each group must contain one or more whole time-series. |"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -415,23 +426,29 @@
|
|||||||
"from azureml.train.automl.runtime._many_models.many_models_parameters import (\n",
|
"from azureml.train.automl.runtime._many_models.many_models_parameters import (\n",
|
||||||
" ManyModelsTrainParameters,\n",
|
" ManyModelsTrainParameters,\n",
|
||||||
")\n",
|
")\n",
|
||||||
|
"from azureml.automl.core.forecasting_parameters import ForecastingParameters\n",
|
||||||
|
"from azureml.train.automl.automlconfig import AutoMLConfig\n",
|
||||||
"\n",
|
"\n",
|
||||||
"partition_column_names = [\"Store\", \"Brand\"]\n",
|
"partition_column_names = [\"Store\", \"Brand\"]\n",
|
||||||
"automl_settings = {\n",
|
"\n",
|
||||||
" \"task\": \"forecasting\",\n",
|
"forecasting_parameters = ForecastingParameters(\n",
|
||||||
" \"primary_metric\": \"normalized_root_mean_squared_error\",\n",
|
" time_column_name=\"WeekStarting\",\n",
|
||||||
" \"iteration_timeout_minutes\": 10, # This needs to be changed based on the dataset. We ask customer to explore how long training is taking before settings this value\n",
|
" forecast_horizon=6,\n",
|
||||||
" \"iterations\": 15,\n",
|
" time_series_id_column_names=partition_column_names,\n",
|
||||||
" \"experiment_timeout_hours\": 0.25,\n",
|
" cv_step_size=\"auto\",\n",
|
||||||
" \"label_column_name\": \"Quantity\",\n",
|
")\n",
|
||||||
" \"n_cross_validations\": \"auto\", # Feel free to set to a small integer (>=2) if runtime is an issue.\n",
|
"\n",
|
||||||
" \"cv_step_size\": \"auto\",\n",
|
"automl_settings = AutoMLConfig(\n",
|
||||||
" \"time_column_name\": \"WeekStarting\",\n",
|
" task=\"forecasting\",\n",
|
||||||
" \"drop_column_names\": \"Revenue\",\n",
|
" primary_metric=\"normalized_root_mean_squared_error\",\n",
|
||||||
" \"forecast_horizon\": 6,\n",
|
" iteration_timeout_minutes=10,\n",
|
||||||
" \"time_series_id_column_names\": partition_column_names,\n",
|
" iterations=15,\n",
|
||||||
" \"track_child_runs\": False,\n",
|
" experiment_timeout_hours=0.25,\n",
|
||||||
"}\n",
|
" label_column_name=\"Quantity\",\n",
|
||||||
|
" n_cross_validations=\"auto\", # Feel free to set to a small integer (>=2) if runtime is an issue.\n",
|
||||||
|
" track_child_runs=False,\n",
|
||||||
|
" forecasting_parameters=forecasting_parameters,\n",
|
||||||
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"mm_paramters = ManyModelsTrainParameters(\n",
|
"mm_paramters = ManyModelsTrainParameters(\n",
|
||||||
" automl_settings=automl_settings, partition_column_names=partition_column_names\n",
|
" automl_settings=automl_settings, partition_column_names=partition_column_names\n",
|
||||||
@@ -451,7 +468,9 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"Reuse of previous results (``allow_reuse``) is key when using pipelines in a collaborative environment since eliminating unnecessary reruns offers agility. Reuse is the default behavior when the ``script_name``, ``inputs``, and the parameters of a step remain the same. When reuse is allowed, results from the previous run are immediately sent to the next step. If ``allow_reuse`` is set to False, a new run will always be generated for this step during pipeline execution.\n",
|
"Reuse of previous results (``allow_reuse``) is key when using pipelines in a collaborative environment since eliminating unnecessary reruns offers agility. Reuse is the default behavior when the ``script_name``, ``inputs``, and the parameters of a step remain the same. When reuse is allowed, results from the previous run are immediately sent to the next step. If ``allow_reuse`` is set to False, a new run will always be generated for this step during pipeline execution.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"> Note that we only support partitioned FileDataset and TabularDataset without partition when using such output as input."
|
"> Note that we only support partitioned FileDataset and TabularDataset without partition when using such output as input.\n",
|
||||||
|
"\n",
|
||||||
|
"> Note that we **drop column** \"Revenue\" from the dataset in this step to avoid information leak as \"Quantity\" = \"Revenue\" / \"Price\". **Please modify the logic based on your data**."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -489,17 +508,25 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"Parallel run step is leveraged to train multiple models at once. To configure the ParallelRunConfig you will need to determine the appropriate number of workers and nodes for your use case. The process_count_per_node is based off the number of cores of the compute VM. The node_count will determine the number of master nodes to use, increasing the node count will speed up the training process.\n",
|
"Parallel run step is leveraged to train multiple models at once. To configure the ParallelRunConfig you will need to determine the appropriate number of workers and nodes for your use case. The ``process_count_per_node`` is based off the number of cores of the compute VM. The node_count will determine the number of master nodes to use, increasing the node count will speed up the training process.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"| Property | Description|\n",
|
"| Property | Description|\n",
|
||||||
"| :--------------- | :------------------- |\n",
|
"| :--------------- | :------------------- |\n",
|
||||||
"| **experiment** | The experiment used for training. |\n",
|
"| **experiment** | The experiment used for training. |\n",
|
||||||
"| **train_data** | The file dataset to be used as input to the training run. |\n",
|
"| **train_data** | The file dataset to be used as input to the training run. |\n",
|
||||||
"| **node_count** | The number of compute nodes to be used for running the user script. We recommend to start with 3 and increase the node_count if the training time is taking too long. |\n",
|
"| **node_count** | The number of compute nodes to be used for running the user script. We recommend to start with 3 and increase the node_count if the training time is taking too long. |\n",
|
||||||
"| **process_count_per_node** | Process count per node, we recommend 2:1 ratio for number of cores: number of processes per node. eg. If node has 16 cores then configure 8 or less process count per node or optimal performance. |\n",
|
"| **process_count_per_node** | Process count per node, we recommend 2:1 ratio for number of cores: number of processes per node. eg. If node has 16 cores then configure 8 or less process count per node for optimal performance. |\n",
|
||||||
"| **train_pipeline_parameters** | The set of configuration parameters defined in the previous section. |\n",
|
"| **train_pipeline_parameters** | The set of configuration parameters defined in the previous section. |\n",
|
||||||
|
"| **run_invocation_timeout** | Maximum amount of time in seconds that the ``ParallelRunStep`` class is allowed. This is optional but provides customers with greater control on exit criteria. This must be greater than ``experiment_timeout_hours`` by at least 300 seconds. |\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Calling this method will create a new aggregated dataset which is generated dynamically on pipeline execution."
|
"Calling this method will create a new aggregated dataset which is generated dynamically on pipeline execution.\n",
|
||||||
|
"\n",
|
||||||
|
"**Note**: Total time taken for the **training step** in the pipeline to complete = $ \\frac{t}{ p \\times n } \\times ts $\n",
|
||||||
|
"where,\n",
|
||||||
|
"- $ t $ is time taken for training one partition (can be viewed in the training logs)\n",
|
||||||
|
"- $ p $ is ``process_count_per_node``\n",
|
||||||
|
"- $ n $ is ``node_count``\n",
|
||||||
|
"- $ ts $ is total number of partitions in time series based on ``partition_column_names``"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -517,7 +544,7 @@
|
|||||||
" compute_target=compute_target,\n",
|
" compute_target=compute_target,\n",
|
||||||
" node_count=2,\n",
|
" node_count=2,\n",
|
||||||
" process_count_per_node=8,\n",
|
" process_count_per_node=8,\n",
|
||||||
" run_invocation_timeout=920,\n",
|
" run_invocation_timeout=1200,\n",
|
||||||
" train_pipeline_parameters=mm_paramters,\n",
|
" train_pipeline_parameters=mm_paramters,\n",
|
||||||
")"
|
")"
|
||||||
]
|
]
|
||||||
@@ -598,7 +625,7 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"### 7.2 Schedule the pipeline\n",
|
"### 5.2 Schedule the pipeline\n",
|
||||||
"You can also [schedule the pipeline](https://docs.microsoft.com/en-us/azure/machine-learning/how-to-schedule-pipelines) to run on a time-based or change-based schedule. This could be used to automatically retrain models every month or based on another trigger such as data drift."
|
"You can also [schedule the pipeline](https://docs.microsoft.com/en-us/azure/machine-learning/how-to-schedule-pipelines) to run on a time-based or change-based schedule. This could be used to automatically retrain models every month or based on another trigger such as data drift."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -654,25 +681,31 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"For many models we need to provide the ManyModelsInferenceParameters object.\n",
|
"For many models we need to provide the ManyModelsInferenceParameters object.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"#### ManyModelsInferenceParameters arguments\n",
|
"#### ``ManyModelsInferenceParameters`` arguments\n",
|
||||||
"| Property | Description|\n",
|
"| Property | Description|\n",
|
||||||
"| :--------------- | :------------------- |\n",
|
"| :--------------- | :------------------- |\n",
|
||||||
"| **partition_column_names** | List of column names that identifies groups. |\n",
|
"| **partition_column_names** | List of column names that identifies groups. |\n",
|
||||||
"| **target_column_name** | \\[Optional] Column name only if the inference dataset has the target. |\n",
|
"| **target_column_name** | \\[Optional] Column name only if the inference dataset has the target. |\n",
|
||||||
"| **time_column_name** | \\[Optional] Column name only if it is timeseries. |\n",
|
"| **time_column_name** | \\[Optional] Time column name only if it is timeseries. |\n",
|
||||||
"| **many_models_run_id** | \\[Optional] Many models run id where models were trained. |\n",
|
"| **inference_type** | \\[Optional] Which inference method to use on the model. Possible values are 'forecast', 'predict_proba', and 'predict'. |\n",
|
||||||
|
"| **forecast_mode** | \\[Optional] The type of forecast to be used, either 'rolling' or 'recursive'; defaults to 'recursive'. |\n",
|
||||||
|
"| **step** | \\[Optional] Number of periods to advance the forecasting window in each iteration **(for rolling forecast only)**; defaults to 1. |\n",
|
||||||
"\n",
|
"\n",
|
||||||
"#### get_many_models_batch_inference_steps arguments\n",
|
"#### ``get_many_models_batch_inference_steps`` arguments\n",
|
||||||
"| Property | Description|\n",
|
"| Property | Description|\n",
|
||||||
"| :--------------- | :------------------- |\n",
|
"| :--------------- | :------------------- |\n",
|
||||||
"| **experiment** | The experiment used for inference run. |\n",
|
"| **experiment** | The experiment used for inference run. |\n",
|
||||||
"| **inference_data** | The data to use for inferencing. It should be the same schema as used for training.\n",
|
"| **inference_data** | The data to use for inferencing. It should be the same schema as used for training.\n",
|
||||||
"| **compute_target** The compute target that runs the inference pipeline.|\n",
|
"| **compute_target** | The compute target that runs the inference pipeline. |\n",
|
||||||
"| **node_count** | The number of compute nodes to be used for running the user script. We recommend to start with the number of cores per node (varies by compute sku). |\n",
|
"| **node_count** | The number of compute nodes to be used for running the user script. We recommend to start with the number of cores per node (varies by compute sku). |\n",
|
||||||
"| **process_count_per_node** The number of processes per node.\n",
|
"| **process_count_per_node** | \\[Optional] The number of processes per node. By default it's 2 (should be at most half of the number of cores in a single node of the compute cluster that will be used for the experiment).\n",
|
||||||
"| **train_run_id** | \\[Optional] The run id of the hierarchy training, by default it is the latest successful training many model run in the experiment. |\n",
|
"| **inference_pipeline_parameters** | \\[Optional] The ``ManyModelsInferenceParameters`` object defined above. |\n",
|
||||||
|
"| **append_row_file_name** | \\[Optional] The name of the output file (optional, default value is 'parallel_run_step.txt'). Supports 'txt' and 'csv' file extension. A 'txt' file extension generates the output in 'txt' format with space as separator without column names. A 'csv' file extension generates the output in 'csv' format with comma as separator and with column names. |\n",
|
||||||
|
"| **train_run_id** | \\[Optional] The run id of the **training pipeline**. By default it is the latest successful training pipeline run in the experiment. |\n",
|
||||||
"| **train_experiment_name** | \\[Optional] The train experiment that contains the train pipeline. This one is only needed when the train pipeline is not in the same experiement as the inference pipeline. |\n",
|
"| **train_experiment_name** | \\[Optional] The train experiment that contains the train pipeline. This one is only needed when the train pipeline is not in the same experiement as the inference pipeline. |\n",
|
||||||
"| **process_count_per_node** | \\[Optional] The number of processes per node, by default it's 4. |"
|
"| **run_invocation_timeout** | \\[Optional] Maximum amount of time in seconds that the ``ParallelRunStep`` class is allowed. This is optional but provides customers with greater control on exit criteria. |\n",
|
||||||
|
"| **output_datastore** | \\[Optional] The ``Datastore`` or ``OutputDatasetConfig`` to be used for output. If specified any pipeline output will be written to that location. If unspecified the default datastore will be used. |\n",
|
||||||
|
"| **arguments** | \\[Optional] Arguments to be passed to inference script. Possible argument is '--forecast_quantiles' followed by quantile values. |"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -692,6 +725,8 @@
|
|||||||
" target_column_name=\"Quantity\",\n",
|
" target_column_name=\"Quantity\",\n",
|
||||||
")\n",
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
"output_file_name = \"parallel_run_step.csv\"\n",
|
||||||
|
"\n",
|
||||||
"inference_steps = AutoMLPipelineBuilder.get_many_models_batch_inference_steps(\n",
|
"inference_steps = AutoMLPipelineBuilder.get_many_models_batch_inference_steps(\n",
|
||||||
" experiment=experiment,\n",
|
" experiment=experiment,\n",
|
||||||
" inference_data=inference_ds_small,\n",
|
" inference_data=inference_ds_small,\n",
|
||||||
@@ -703,6 +738,8 @@
|
|||||||
" train_run_id=training_run.id,\n",
|
" train_run_id=training_run.id,\n",
|
||||||
" train_experiment_name=training_run.experiment.name,\n",
|
" train_experiment_name=training_run.experiment.name,\n",
|
||||||
" inference_pipeline_parameters=mm_parameters,\n",
|
" inference_pipeline_parameters=mm_parameters,\n",
|
||||||
|
" append_row_file_name=output_file_name,\n",
|
||||||
|
" arguments=[\"--forecast_quantiles\", 0.1, 0.9],\n",
|
||||||
")"
|
")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -737,7 +774,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"The following code snippet:\n",
|
"The following code snippet:\n",
|
||||||
"1. Downloads the contents of the output folder that is passed in the parallel run step \n",
|
"1. Downloads the contents of the output folder that is passed in the parallel run step \n",
|
||||||
"2. Reads the parallel_run_step.txt file that has the predictions as pandas dataframe and \n",
|
"2. Reads the output file that has the predictions as pandas dataframe and \n",
|
||||||
"3. Displays the top 10 rows of the predictions"
|
"3. Displays the top 10 rows of the predictions"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -752,19 +789,9 @@
|
|||||||
"forecasting_results_name = \"forecasting_results\"\n",
|
"forecasting_results_name = \"forecasting_results\"\n",
|
||||||
"forecasting_output_name = \"many_models_inference_output\"\n",
|
"forecasting_output_name = \"many_models_inference_output\"\n",
|
||||||
"forecast_file = get_output_from_mm_pipeline(\n",
|
"forecast_file = get_output_from_mm_pipeline(\n",
|
||||||
" inference_run, forecasting_results_name, forecasting_output_name\n",
|
" inference_run, forecasting_results_name, forecasting_output_name, output_file_name\n",
|
||||||
")\n",
|
")\n",
|
||||||
"df = pd.read_csv(forecast_file, delimiter=\" \", header=None)\n",
|
"df = pd.read_csv(forecast_file)\n",
|
||||||
"df.columns = [\n",
|
|
||||||
" \"Week Starting\",\n",
|
|
||||||
" \"Store\",\n",
|
|
||||||
" \"Brand\",\n",
|
|
||||||
" \"Quantity\",\n",
|
|
||||||
" \"Advert\",\n",
|
|
||||||
" \"Price\",\n",
|
|
||||||
" \"Revenue\",\n",
|
|
||||||
" \"Predicted\",\n",
|
|
||||||
"]\n",
|
|
||||||
"print(\n",
|
"print(\n",
|
||||||
" \"Prediction has \", df.shape[0], \" rows. Here the first 10 rows are being displayed.\"\n",
|
" \"Prediction has \", df.shape[0], \" rows. Here the first 10 rows are being displayed.\"\n",
|
||||||
")\n",
|
")\n",
|
||||||
@@ -837,9 +864,9 @@
|
|||||||
"automated-machine-learning"
|
"automated-machine-learning"
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.6 MiB |
@@ -11,6 +11,12 @@ def main(args):
|
|||||||
dataset = run_context.input_datasets["train_10_models"]
|
dataset = run_context.input_datasets["train_10_models"]
|
||||||
df = dataset.to_pandas_dataframe()
|
df = dataset.to_pandas_dataframe()
|
||||||
|
|
||||||
|
# Drop the column "Revenue" from the dataset to avoid information leak as
|
||||||
|
# "Quantity" = "Revenue" / "Price". Please modify the logic based on your data.
|
||||||
|
drop_column_name = "Revenue"
|
||||||
|
if drop_column_name in df.columns:
|
||||||
|
df.drop(drop_column_name, axis=1, inplace=True)
|
||||||
|
|
||||||
# Apply any data pre-processing techniques here
|
# Apply any data pre-processing techniques here
|
||||||
|
|
||||||
df.to_parquet(output / "data_prepared_result.parquet", compression=None)
|
df.to_parquet(output / "data_prepared_result.parquet", compression=None)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
"## Introduction<a id=\"introduction\"></a>\n",
|
"## Introduction<a id=\"introduction\"></a>\n",
|
||||||
"In this example, we use AutoML to train, select, and operationalize a time-series forecasting model for multiple time-series.\n",
|
"In this example, we use AutoML to train, select, and operationalize a time-series forecasting model for multiple time-series.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Make sure you have executed the [configuration notebook](../../../configuration.ipynb) before running this notebook.\n",
|
"Make sure you have executed the [configuration notebook](https://github.com/Azure/MachineLearningNotebooks/blob/master/configuration.ipynb) before running this notebook.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"The examples in the follow code samples use the University of Chicago's Dominick's Finer Foods dataset to forecast orange juice sales. Dominick's was a grocery chain in the Chicago metropolitan area."
|
"The examples in the follow code samples use the University of Chicago's Dominick's Finer Foods dataset to forecast orange juice sales. Dominick's was a grocery chain in the Chicago metropolitan area."
|
||||||
]
|
]
|
||||||
@@ -821,9 +821,9 @@
|
|||||||
"friendly_name": "Forecasting orange juice sales with deployment",
|
"friendly_name": "Forecasting orange juice sales with deployment",
|
||||||
"index_order": 1,
|
"index_order": 1,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"## Introduction\n",
|
"## Introduction\n",
|
||||||
"\n",
|
"\n",
|
||||||
"In this notebook, we demonstrate how to use piplines to train and inference on AutoML Forecasting model. Two pipelines will be created: one for training AutoML model, and the other is for inference on AutoML model. We'll also demonstrate how to schedule the inference pipeline so you can get inference results periodically (with refreshed test dataset). Make sure you have executed the configuration notebook before running this notebook. In this notebook you will learn how to:\n",
|
"In this notebook, we demonstrate how to use piplines to train and inference on AutoML Forecasting model. Two pipelines will be created: one for training AutoML model, and the other is for inference on AutoML model. We'll also demonstrate how to schedule the inference pipeline so you can get inference results periodically (with refreshed test dataset). Make sure you have executed the [configuration notebook](https://github.com/Azure/MachineLearningNotebooks/blob/master/configuration.ipynb) before running this notebook. In this notebook you will learn how to:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"- Configure AutoML using AutoMLConfig for forecasting tasks using pipeline AutoMLSteps.\n",
|
"- Configure AutoML using AutoMLConfig for forecasting tasks using pipeline AutoMLSteps.\n",
|
||||||
"- Create and register an AutoML model using AzureML pipeline.\n",
|
"- Create and register an AutoML model using AzureML pipeline.\n",
|
||||||
@@ -799,9 +799,9 @@
|
|||||||
"friendly_name": "Forecasting orange juice sales with deployment",
|
"friendly_name": "Forecasting orange juice sales with deployment",
|
||||||
"index_order": 1,
|
"index_order": 1,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -472,9 +472,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -572,9 +572,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -870,9 +870,9 @@
|
|||||||
"friendly_name": "Classification of credit card fraudulent transactions using Automated ML",
|
"friendly_name": "Classification of credit card fraudulent transactions using Automated ML",
|
||||||
"index_order": 5,
|
"index_order": 5,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -859,8 +859,8 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"%matplotlib inline\n",
|
"%matplotlib inline\n",
|
||||||
"test_pred = plt.scatter(y_test, y_pred_test, color=\"\")\n",
|
"test_pred = plt.scatter(y_test, y_pred_test, c=[\"b\"])\n",
|
||||||
"test_test = plt.scatter(y_test, y_test, color=\"g\")\n",
|
"test_test = plt.scatter(y_test, y_test, c=[\"g\"])\n",
|
||||||
"plt.legend(\n",
|
"plt.legend(\n",
|
||||||
" (test_pred, test_test), (\"prediction\", \"truth\"), loc=\"upper left\", fontsize=8\n",
|
" (test_pred, test_test), (\"prediction\", \"truth\"), loc=\"upper left\", fontsize=8\n",
|
||||||
")\n",
|
")\n",
|
||||||
@@ -895,9 +895,9 @@
|
|||||||
"friendly_name": "Automated ML run with featurization and model explainability.",
|
"friendly_name": "Automated ML run with featurization and model explainability.",
|
||||||
"index_order": 5,
|
"index_order": 5,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -422,8 +422,8 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"%matplotlib inline\n",
|
"%matplotlib inline\n",
|
||||||
"test_pred = plt.scatter(y_test, y_pred_test, color=\"\")\n",
|
"test_pred = plt.scatter(y_test, y_pred_test, c=[\"b\"])\n",
|
||||||
"test_test = plt.scatter(y_test, y_test, color=\"g\")\n",
|
"test_test = plt.scatter(y_test, y_test, c=[\"g\"])\n",
|
||||||
"plt.legend(\n",
|
"plt.legend(\n",
|
||||||
" (test_pred, test_test), (\"prediction\", \"truth\"), loc=\"upper left\", fontsize=8\n",
|
" (test_pred, test_test), (\"prediction\", \"truth\"), loc=\"upper left\", fontsize=8\n",
|
||||||
")\n",
|
")\n",
|
||||||
@@ -449,9 +449,9 @@
|
|||||||
"automated-machine-learning"
|
"automated-machine-learning"
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -429,9 +429,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -557,9 +557,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -161,9 +161,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -215,9 +215,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -482,9 +482,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -302,9 +302,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"In this example, we will be using and registering two models. \n",
|
"In this example, we will be using and registering two models. \n",
|
||||||
"\n",
|
"\n",
|
||||||
"First we will train two simple models on the [diabetes dataset](https://scikit-learn.org/stable/datasets/index.html#diabetes-dataset) included with scikit-learn, serializing them to files in the current directory."
|
"First we will train two simple models on the [diabetes dataset](https://scikit-learn.org/stable/datasets/toy_dataset.html#diabetes-dataset) included with scikit-learn, serializing them to files in the current directory."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -239,7 +239,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"env = Environment(\"deploytocloudenv\")\n",
|
"env = Environment(\"deploytocloudenv\")\n",
|
||||||
"env.python.conda_dependencies.add_pip_package(\"joblib\")\n",
|
"env.python.conda_dependencies.add_pip_package(\"joblib\")\n",
|
||||||
"env.python.conda_dependencies.add_pip_package(\"numpy\")\n",
|
"env.python.conda_dependencies.add_pip_package(\"numpy==1.23\")\n",
|
||||||
"env.python.conda_dependencies.add_pip_package(\"scikit-learn=={}\".format(sklearn.__version__))"
|
"env.python.conda_dependencies.add_pip_package(\"scikit-learn=={}\".format(sklearn.__version__))"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -373,9 +373,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -285,7 +285,7 @@
|
|||||||
" 'azureml-defaults',\n",
|
" 'azureml-defaults',\n",
|
||||||
" 'inference-schema[numpy-support]',\n",
|
" 'inference-schema[numpy-support]',\n",
|
||||||
" 'joblib',\n",
|
" 'joblib',\n",
|
||||||
" 'numpy',\n",
|
" 'numpy==1.23',\n",
|
||||||
" 'scikit-learn=={}'.format(sklearn.__version__)\n",
|
" 'scikit-learn=={}'.format(sklearn.__version__)\n",
|
||||||
"])"
|
"])"
|
||||||
]
|
]
|
||||||
@@ -486,7 +486,7 @@
|
|||||||
" 'azureml-defaults',\n",
|
" 'azureml-defaults',\n",
|
||||||
" 'inference-schema[numpy-support]',\n",
|
" 'inference-schema[numpy-support]',\n",
|
||||||
" 'joblib',\n",
|
" 'joblib',\n",
|
||||||
" 'numpy',\n",
|
" 'numpy==1.23',\n",
|
||||||
" 'scikit-learn=={}'.format(sklearn.__version__)\n",
|
" 'scikit-learn=={}'.format(sklearn.__version__)\n",
|
||||||
"])\n",
|
"])\n",
|
||||||
"inference_config = InferenceConfig(entry_script='score.py', environment=environment)\n",
|
"inference_config = InferenceConfig(entry_script='score.py', environment=environment)\n",
|
||||||
@@ -541,7 +541,7 @@
|
|||||||
" - To run a local web service, see the [notebook on deployment to a local Docker container](../deploy-to-local/register-model-deploy-local.ipynb).\n",
|
" - To run a local web service, see the [notebook on deployment to a local Docker container](../deploy-to-local/register-model-deploy-local.ipynb).\n",
|
||||||
" - For more information on datasets, see the [notebook on training with datasets](../../work-with-data/datasets-tutorial/train-with-datasets/train-with-datasets.ipynb).\n",
|
" - For more information on datasets, see the [notebook on training with datasets](../../work-with-data/datasets-tutorial/train-with-datasets/train-with-datasets.ipynb).\n",
|
||||||
" - For more information on environments, see the [notebook on using environments](../../training/using-environments/using-environments.ipynb).\n",
|
" - For more information on environments, see the [notebook on using environments](../../training/using-environments/using-environments.ipynb).\n",
|
||||||
" - For information on all the available deployment targets, see [“How and where to deploy models”](https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-deploy-and-where#choose-a-compute-target)."
|
" - For information on all the available deployment targets, see [“How and where to deploy models”](https://docs.microsoft.com/azure/machine-learning/v1/how-to-deploy-and-where#choose-a-compute-target)."
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -568,9 +568,9 @@
|
|||||||
"friendly_name": "Register model and deploy as webservice",
|
"friendly_name": "Register model and deploy as webservice",
|
||||||
"index_order": 3,
|
"index_order": 3,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -473,9 +473,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -529,9 +529,9 @@
|
|||||||
"friendly_name": "Register a model and deploy locally",
|
"friendly_name": "Register a model and deploy locally",
|
||||||
"index_order": 1,
|
"index_order": 1,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -110,7 +110,7 @@
|
|||||||
" pip_packages=[\n",
|
" pip_packages=[\n",
|
||||||
" 'azureml-defaults',\n",
|
" 'azureml-defaults',\n",
|
||||||
" 'inference-schema[numpy-support]',\n",
|
" 'inference-schema[numpy-support]',\n",
|
||||||
" 'numpy',\n",
|
" 'numpy==1.23',\n",
|
||||||
" 'scikit-learn==0.22.1',\n",
|
" 'scikit-learn==0.22.1',\n",
|
||||||
" 'scipy'\n",
|
" 'scipy'\n",
|
||||||
"])"
|
"])"
|
||||||
@@ -344,9 +344,9 @@
|
|||||||
"friendly_name": "Deploy models to AKS using controlled roll out",
|
"friendly_name": "Deploy models to AKS using controlled roll out",
|
||||||
"index_order": 3,
|
"index_order": 3,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -476,9 +476,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -405,9 +405,9 @@
|
|||||||
"friendly_name": "Convert and deploy TinyYolo with ONNX Runtime",
|
"friendly_name": "Convert and deploy TinyYolo with ONNX Runtime",
|
||||||
"index_order": 5,
|
"index_order": 5,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -773,9 +773,9 @@
|
|||||||
"friendly_name": "Deploy Facial Expression Recognition (FER+) with ONNX Runtime",
|
"friendly_name": "Deploy Facial Expression Recognition (FER+) with ONNX Runtime",
|
||||||
"index_order": 2,
|
"index_order": 2,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -750,9 +750,9 @@
|
|||||||
"friendly_name": "Deploy MNIST digit recognition with ONNX Runtime",
|
"friendly_name": "Deploy MNIST digit recognition with ONNX Runtime",
|
||||||
"index_order": 1,
|
"index_order": 1,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -206,9 +206,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -389,9 +389,9 @@
|
|||||||
"friendly_name": "Deploy ResNet50 with ONNX Runtime",
|
"friendly_name": "Deploy ResNet50 with ONNX Runtime",
|
||||||
"index_order": 4,
|
"index_order": 4,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -564,9 +564,9 @@
|
|||||||
"friendly_name": "Train MNIST in PyTorch, convert, and deploy with ONNX Runtime",
|
"friendly_name": "Train MNIST in PyTorch, convert, and deploy with ONNX Runtime",
|
||||||
"index_order": 3,
|
"index_order": 3,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -240,9 +240,9 @@
|
|||||||
"# Please see [Azure ML Containers repository](https://github.com/Azure/AzureML-Containers#featured-tags)\n",
|
"# Please see [Azure ML Containers repository](https://github.com/Azure/AzureML-Containers#featured-tags)\n",
|
||||||
"# for open-sourced GPU base images.\n",
|
"# for open-sourced GPU base images.\n",
|
||||||
"env.docker.base_image = DEFAULT_GPU_IMAGE\n",
|
"env.docker.base_image = DEFAULT_GPU_IMAGE\n",
|
||||||
"env.python.conda_dependencies = CondaDependencies.create(python_version=\"3.6.2\", \n",
|
"env.python.conda_dependencies = CondaDependencies.create(python_version=\"3.6.2\", pin_sdk_version=False,\n",
|
||||||
" conda_packages=['tensorflow-gpu==1.12.0','numpy'],\n",
|
" conda_packages=['tensorflow-gpu==1.12.0','numpy'],\n",
|
||||||
" pip_packages=['azureml-contrib-services', 'azureml-defaults'])\n",
|
" pip_packages=['azureml-contrib-services==1.47.0', 'azureml-defaults==1.47.0'])\n",
|
||||||
"\n",
|
"\n",
|
||||||
"inference_config = InferenceConfig(entry_script=\"score.py\", environment=env)\n",
|
"inference_config = InferenceConfig(entry_script=\"score.py\", environment=env)\n",
|
||||||
"aks_config = AksWebservice.deploy_configuration()\n",
|
"aks_config = AksWebservice.deploy_configuration()\n",
|
||||||
@@ -329,9 +329,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
@@ -343,7 +343,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.6.6"
|
"version": "3.7.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
@@ -213,7 +213,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"> Note that if you have an AzureML Data Scientist role, you will not have permission to create compute resources. Talk to your workspace or IT admin to create the compute targets described in this section, if they do not already exist.\n",
|
"> Note that if you have an AzureML Data Scientist role, you will not have permission to create compute resources. Talk to your workspace or IT admin to create the compute targets described in this section, if they do not already exist.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"See code snippet below. Check the documentation [here](https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-secure-web-service) for more details"
|
"See code snippet below. Check the documentation [here](https://docs.microsoft.com/azure/machine-learning/v1/how-to-secure-web-service) for more details"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -334,9 +334,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -5,4 +5,4 @@ dependencies:
|
|||||||
- matplotlib
|
- matplotlib
|
||||||
- tqdm
|
- tqdm
|
||||||
- scipy
|
- scipy
|
||||||
- sklearn
|
- scikit-learn
|
||||||
|
|||||||
@@ -366,7 +366,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"# Create AKS Cluster in an existing virtual network (optional)\n",
|
"# Create AKS Cluster in an existing virtual network (optional)\n",
|
||||||
"See code snippet below. Check the documentation [here](https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-enable-virtual-network#use-azure-kubernetes-service) for more details."
|
"See code snippet below. Check the documentation [here](https://docs.microsoft.com/en-us/azure/machine-learning/how-to-network-security-overview) for more details."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -397,7 +397,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"# Enable SSL on the AKS Cluster (optional)\n",
|
"# Enable SSL on the AKS Cluster (optional)\n",
|
||||||
"See code snippet below. Check the documentation [here](https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-secure-web-service) for more details"
|
"See code snippet below. Check the documentation [here](https://docs.microsoft.com/en-us/azure/machine-learning/how-to-network-security-overview#secure-the-inferencing-environment-v1) for more details"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -603,9 +603,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -5,4 +5,4 @@ dependencies:
|
|||||||
- matplotlib
|
- matplotlib
|
||||||
- tqdm
|
- tqdm
|
||||||
- scipy
|
- scipy
|
||||||
- sklearn
|
- scikit-learn
|
||||||
|
|||||||
@@ -137,7 +137,7 @@
|
|||||||
"myenv = Environment('my-pyspark-environment')\r\n",
|
"myenv = Environment('my-pyspark-environment')\r\n",
|
||||||
"myenv.docker.base_image = \"mcr.microsoft.com/mmlspark/release:0.15\"\r\n",
|
"myenv.docker.base_image = \"mcr.microsoft.com/mmlspark/release:0.15\"\r\n",
|
||||||
"myenv.inferencing_stack_version = \"latest\"\r\n",
|
"myenv.inferencing_stack_version = \"latest\"\r\n",
|
||||||
"myenv.python.conda_dependencies = CondaDependencies.create(pip_packages=[\"azureml-core\",\"azureml-defaults\",\"azureml-telemetry\",\"azureml-train-restclients-hyperdrive\",\"azureml-train-core\"], python_version=\"3.6.2\")\r\n",
|
"myenv.python.conda_dependencies = CondaDependencies.create(pip_packages=[\"azureml-core\",\"azureml-defaults\",\"azureml-telemetry\",\"azureml-train-restclients-hyperdrive\",\"azureml-train-core\"], python_version=\"3.7.0\")\r\n",
|
||||||
"myenv.python.conda_dependencies.add_channel(\"conda-forge\")\r\n",
|
"myenv.python.conda_dependencies.add_channel(\"conda-forge\")\r\n",
|
||||||
"myenv.spark.packages = [SparkPackage(\"com.microsoft.ml.spark\", \"mmlspark_2.11\", \"0.15\"), SparkPackage(\"com.microsoft.azure\", \"azure-storage\", \"2.0.0\"), SparkPackage(\"org.apache.hadoop\", \"hadoop-azure\", \"2.7.0\")]\r\n",
|
"myenv.spark.packages = [SparkPackage(\"com.microsoft.ml.spark\", \"mmlspark_2.11\", \"0.15\"), SparkPackage(\"com.microsoft.azure\", \"azure-storage\", \"2.0.0\"), SparkPackage(\"org.apache.hadoop\", \"hadoop-azure\", \"2.7.0\")]\r\n",
|
||||||
"myenv.spark.repositories = [\"https://mmlspark.azureedge.net/maven\"]\r\n"
|
"myenv.spark.repositories = [\"https://mmlspark.azureedge.net/maven\"]\r\n"
|
||||||
@@ -327,9 +327,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "Register Spark model and deploy as webservice",
|
"friendly_name": "Register Spark model and deploy as webservice",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
@@ -341,7 +341,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.6.2"
|
"version": "3.7.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
@@ -106,7 +106,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"print(\"This notebook was created using version 1.45.0 of the Azure ML SDK\")\n",
|
"print(\"This notebook was created using version Latest of the Azure ML SDK\")\n",
|
||||||
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
|
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -235,18 +235,30 @@
|
|||||||
"# Note: this is to pin the pandas and xgboost versions to be same as notebook.\n",
|
"# Note: this is to pin the pandas and xgboost versions to be same as notebook.\n",
|
||||||
"# In production scenario user would choose their dependencies\n",
|
"# In production scenario user would choose their dependencies\n",
|
||||||
"import pkg_resources\n",
|
"import pkg_resources\n",
|
||||||
|
"from distutils.version import LooseVersion\n",
|
||||||
"available_packages = pkg_resources.working_set\n",
|
"available_packages = pkg_resources.working_set\n",
|
||||||
"pandas_ver = None\n",
|
"pandas_ver = None\n",
|
||||||
"numpy_ver = None\n",
|
"numpy_ver = None\n",
|
||||||
|
"sklearn_ver = None\n",
|
||||||
"for dist in list(available_packages):\n",
|
"for dist in list(available_packages):\n",
|
||||||
" if dist.key == 'pandas':\n",
|
" if dist.key == 'pandas':\n",
|
||||||
" pandas_ver = dist.version\n",
|
" pandas_ver = dist.version\n",
|
||||||
|
" if dist.key == 'numpy':\n",
|
||||||
|
" if LooseVersion(dist.version) >= LooseVersion('1.20.0'):\n",
|
||||||
|
" numpy_ver = dist.version\n",
|
||||||
|
" else:\n",
|
||||||
|
" numpy_ver = '1.21.6'\n",
|
||||||
|
" if dist.key == 'scikit-learn':\n",
|
||||||
|
" sklearn_ver = dist.version\n",
|
||||||
"pandas_dep = 'pandas'\n",
|
"pandas_dep = 'pandas'\n",
|
||||||
"numpy_dep = 'numpy'\n",
|
"numpy_dep = 'numpy'\n",
|
||||||
|
"sklearn_dep = 'scikit-learn'\n",
|
||||||
"if pandas_ver:\n",
|
"if pandas_ver:\n",
|
||||||
" pandas_dep = 'pandas=={}'.format(pandas_ver)\n",
|
" pandas_dep = 'pandas=={}'.format(pandas_ver)\n",
|
||||||
"if numpy_ver:\n",
|
"if numpy_ver:\n",
|
||||||
" numpy_dep = 'numpy=={}'.format(numpy_ver)\n",
|
" numpy_dep = 'numpy=={}'.format(numpy_ver)\n",
|
||||||
|
"if sklearn_ver:\n",
|
||||||
|
" sklearn_dep = 'scikit-learn=={}'.format(sklearn_ver)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Note: we build shap at commit 690245 for Tesla K80 GPUs\n",
|
"# Note: we build shap at commit 690245 for Tesla K80 GPUs\n",
|
||||||
"env.docker.base_dockerfile = f\"\"\"\n",
|
"env.docker.base_dockerfile = f\"\"\"\n",
|
||||||
@@ -286,7 +298,9 @@
|
|||||||
"pip uninstall -y xgboost && \\\n",
|
"pip uninstall -y xgboost && \\\n",
|
||||||
"conda install py-xgboost==1.3.3 && \\\n",
|
"conda install py-xgboost==1.3.3 && \\\n",
|
||||||
"pip uninstall -y numpy && \\\n",
|
"pip uninstall -y numpy && \\\n",
|
||||||
"conda install {numpy_dep} \\\n",
|
"pip install {numpy_dep} && \\\n",
|
||||||
|
"pip install {sklearn_dep} && \\\n",
|
||||||
|
"pip install chardet \\\n",
|
||||||
"\"\"\"\n",
|
"\"\"\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"env.python.user_managed_dependencies = True\n",
|
"env.python.user_managed_dependencies = True\n",
|
||||||
@@ -481,9 +495,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ dependencies:
|
|||||||
- ipython
|
- ipython
|
||||||
- matplotlib
|
- matplotlib
|
||||||
- ipywidgets
|
- ipywidgets
|
||||||
- raiwidgets~=0.21.0
|
- raiwidgets~=0.24.0
|
||||||
- itsdangerous==2.0.1
|
- itsdangerous==2.0.1
|
||||||
- markupsafe<2.1.0
|
- markupsafe<2.1.0
|
||||||
- scipy>=1.5.3
|
- scipy>=1.5.3
|
||||||
|
|||||||
@@ -496,9 +496,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ dependencies:
|
|||||||
- matplotlib
|
- matplotlib
|
||||||
- azureml-dataset-runtime
|
- azureml-dataset-runtime
|
||||||
- ipywidgets
|
- ipywidgets
|
||||||
- raiwidgets~=0.21.0
|
- raiwidgets~=0.24.0
|
||||||
- itsdangerous==2.0.1
|
- itsdangerous==2.0.1
|
||||||
- markupsafe<2.1.0
|
- markupsafe<2.1.0
|
||||||
- scipy>=1.5.3
|
- scipy>=1.5.3
|
||||||
|
|||||||
@@ -595,9 +595,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ dependencies:
|
|||||||
- ipython
|
- ipython
|
||||||
- matplotlib
|
- matplotlib
|
||||||
- ipywidgets
|
- ipywidgets
|
||||||
- raiwidgets~=0.21.0
|
- raiwidgets~=0.24.0
|
||||||
- packaging>=20.9
|
- packaging>=20.9
|
||||||
- itsdangerous==2.0.1
|
- itsdangerous==2.0.1
|
||||||
- markupsafe<2.1.0
|
- markupsafe<2.1.0
|
||||||
|
|||||||
@@ -516,9 +516,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ dependencies:
|
|||||||
- ipython
|
- ipython
|
||||||
- matplotlib
|
- matplotlib
|
||||||
- ipywidgets
|
- ipywidgets
|
||||||
- raiwidgets~=0.21.0
|
- raiwidgets~=0.24.0
|
||||||
- packaging>=20.9
|
- packaging>=20.9
|
||||||
- itsdangerous==2.0.1
|
- itsdangerous==2.0.1
|
||||||
- markupsafe<2.1.0
|
- markupsafe<2.1.0
|
||||||
|
|||||||
@@ -576,9 +576,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ dependencies:
|
|||||||
- azureml-dataset-runtime
|
- azureml-dataset-runtime
|
||||||
- azureml-core
|
- azureml-core
|
||||||
- ipywidgets
|
- ipywidgets
|
||||||
- raiwidgets~=0.21.0
|
- raiwidgets~=0.24.0
|
||||||
- itsdangerous==2.0.1
|
- itsdangerous==2.0.1
|
||||||
- markupsafe<2.1.0
|
- markupsafe<2.1.0
|
||||||
- scipy>=1.5.3
|
- scipy>=1.5.3
|
||||||
|
|||||||
@@ -579,9 +579,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "Azure Machine Learning Pipeline with DataTranferStep",
|
"friendly_name": "Azure Machine Learning Pipeline with DataTranferStep",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -632,9 +632,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "Getting Started with Azure Machine Learning Pipelines",
|
"friendly_name": "Getting Started with Azure Machine Learning Pipelines",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -384,9 +384,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "Azure Machine Learning Pipeline with AzureBatchStep",
|
"friendly_name": "Azure Machine Learning Pipeline with AzureBatchStep",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -470,9 +470,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "How to use ModuleStep with AML Pipelines",
|
"friendly_name": "How to use ModuleStep with AML Pipelines",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -261,9 +261,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "How to use Pipeline Drafts to create a Published Pipeline",
|
"friendly_name": "How to use Pipeline Drafts to create a Published Pipeline",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -292,7 +292,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"tf_env = Environment.get(ws, name='AzureML-TensorFlow-2.0-GPU')"
|
"tf_env = Environment.get(ws, name='AzureML-tensorflow-2.6-ubuntu20.04-py38-cuda11-gpu')"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -595,9 +595,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "Azure Machine Learning Pipeline with HyperDriveStep",
|
"friendly_name": "Azure Machine Learning Pipeline with HyperDriveStep",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -443,9 +443,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "How to Publish a Pipeline and Invoke the REST endpoint",
|
"friendly_name": "How to Publish a Pipeline and Invoke the REST endpoint",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -432,7 +432,7 @@
|
|||||||
"This schedule will run when additions or modifications are made to Blobs in the Datastore.\n",
|
"This schedule will run when additions or modifications are made to Blobs in the Datastore.\n",
|
||||||
"By default, the Datastore container is monitored for changes. Use the path_on_datastore parameter to instead specify a path on the Datastore to monitor for changes. Note: the path_on_datastore will be under the container for the datastore, so the actual path monitored will be container/path_on_datastore. Changes made to subfolders in the container/path will not trigger the schedule.\n",
|
"By default, the Datastore container is monitored for changes. Use the path_on_datastore parameter to instead specify a path on the Datastore to monitor for changes. Note: the path_on_datastore will be under the container for the datastore, so the actual path monitored will be container/path_on_datastore. Changes made to subfolders in the container/path will not trigger the schedule.\n",
|
||||||
"Note: Only Blob Datastores are supported.\n",
|
"Note: Only Blob Datastores are supported.\n",
|
||||||
"Note: Not supported for CMK workspaces. Please review these [instructions](https://docs.microsoft.com/azure/machine-learning/how-to-trigger-published-pipeline) in order to setup a blob trigger submission schedule with CMK enabled. Also see those instructions to bring your own LogicApp to avoid the schedule triggers per month limit."
|
"Note: Not supported for CMK workspaces. Please review these [instructions](https://docs.microsoft.com/azure/machine-learning/v1/how-to-trigger-published-pipeline) in order to setup a blob trigger submission schedule with CMK enabled. Also see those instructions to bring your own LogicApp to avoid the schedule triggers per month limit."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -637,9 +637,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "How to Setup a Schedule for a Published Pipeline or Pipeline Endpoint",
|
"friendly_name": "How to Setup a Schedule for a Published Pipeline or Pipeline Endpoint",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -581,9 +581,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "How to setup a versioned Pipeline Endpoint",
|
"friendly_name": "How to setup a versioned Pipeline Endpoint",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -500,9 +500,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "How to use DataPath as a PipelineParameter",
|
"friendly_name": "How to use DataPath as a PipelineParameter",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -496,9 +496,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "How to use Dataset as a PipelineParameter",
|
"friendly_name": "How to use Dataset as a PipelineParameter",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -377,9 +377,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "How to use AdlaStep with AML Pipelines",
|
"friendly_name": "How to use AdlaStep with AML Pipelines",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"# Using Databricks as a Compute Target from Azure Machine Learning Pipeline\n",
|
"# Using Databricks as a Compute Target from Azure Machine Learning Pipeline\n",
|
||||||
"To use Databricks as a compute target from [Azure Machine Learning Pipeline](https://aka.ms/pl-concept), a [DatabricksStep](https://docs.microsoft.com/en-us/python/api/azureml-pipeline-steps/azureml.pipeline.steps.databricks_step.databricksstep?view=azure-ml-py) is used. This notebook demonstrates the use of DatabricksStep in Azure Machine Learning Pipeline.\n",
|
"To use Databricks as a compute target from [Azure Machine Learning Pipeline](https://aka.ms/pl-concept), a [DatabricksStep](https://docs.microsoft.com/python/api/azureml-pipeline-steps/azureml.pipeline.steps.databricks_step.databricksstep?view=azure-ml-py) is used. This notebook demonstrates the use of DatabricksStep in Azure Machine Learning Pipeline.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"The notebook will show:\n",
|
"The notebook will show:\n",
|
||||||
"1. Running an arbitrary Databricks notebook that the customer has in Databricks workspace\n",
|
"1. Running an arbitrary Databricks notebook that the customer has in Databricks workspace\n",
|
||||||
@@ -180,10 +180,9 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"## Data Connections with Inputs and Outputs\n",
|
"## Data Connections with Inputs and Outputs\n",
|
||||||
"The DatabricksStep supports DBFS, Azure Blob and ADLS for inputs and outputs. You also will need to define a [Secrets](https://docs.azuredatabricks.net/user-guide/secrets/index.html) scope to enable authentication to external data sources such as Blob and ADLS from Databricks.\n",
|
"The DatabricksStep supports DBFS, Azure Blob and ADLS for inputs and outputs. You also will need to define a [Secrets](https://docs.microsoft.com/azure/databricks/security/access-control/secret-acl) scope to enable authentication to external data sources such as Blob and ADLS from Databricks.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"- Databricks documentation on [Azure Blob](https://docs.azuredatabricks.net/spark/latest/data-sources/azure/azure-storage.html)\n",
|
"- Databricks documentation on [Azure Storage](https://docs.microsoft.com/azure/databricks/data/data-sources/azure/azure-storage)\n",
|
||||||
"- Databricks documentation on [ADLS](https://docs.databricks.com/spark/latest/data-sources/azure/azure-datalake.html)\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"### Type of Data Access\n",
|
"### Type of Data Access\n",
|
||||||
"Databricks allows to interact with Azure Blob and ADLS in two ways.\n",
|
"Databricks allows to interact with Azure Blob and ADLS in two ways.\n",
|
||||||
@@ -331,7 +330,7 @@
|
|||||||
"- **inputs:** List of input connections for data consumed by this step. Fetch this inside the notebook using dbutils.widgets.get(\"input\")\n",
|
"- **inputs:** List of input connections for data consumed by this step. Fetch this inside the notebook using dbutils.widgets.get(\"input\")\n",
|
||||||
"- **outputs:** List of output port definitions for outputs produced by this step. Fetch this inside the notebook using dbutils.widgets.get(\"output\")\n",
|
"- **outputs:** List of output port definitions for outputs produced by this step. Fetch this inside the notebook using dbutils.widgets.get(\"output\")\n",
|
||||||
"- **existing_cluster_id:** Cluster ID of an existing Interactive cluster on the Databricks workspace. If you are providing this, do not provide any of the parameters below that are used to create a new cluster such as spark_version, node_type, etc.\n",
|
"- **existing_cluster_id:** Cluster ID of an existing Interactive cluster on the Databricks workspace. If you are providing this, do not provide any of the parameters below that are used to create a new cluster such as spark_version, node_type, etc.\n",
|
||||||
"- **spark_version:** Version of spark for the databricks run cluster. default value: 4.0.x-scala2.11\n",
|
"- **spark_version:** Version of spark for the databricks run cluster. You can refer to [DataBricks runtime version](https://learn.microsoft.com/azure/databricks/dev-tools/api/#--runtime-version-strings) to specify the spark version. default value: 10.4.x-scala2.12\n",
|
||||||
"- **node_type:** Azure vm node types for the databricks run cluster. default value: Standard_D3_v2\n",
|
"- **node_type:** Azure vm node types for the databricks run cluster. default value: Standard_D3_v2\n",
|
||||||
"- **num_workers:** Specifies a static number of workers for the databricks run cluster\n",
|
"- **num_workers:** Specifies a static number of workers for the databricks run cluster\n",
|
||||||
"- **min_workers:** Specifies a min number of workers to use for auto-scaling the databricks run cluster\n",
|
"- **min_workers:** Specifies a min number of workers to use for auto-scaling the databricks run cluster\n",
|
||||||
@@ -415,7 +414,7 @@
|
|||||||
"### 1. Running the demo notebook already added to the Databricks workspace\n",
|
"### 1. Running the demo notebook already added to the Databricks workspace\n",
|
||||||
"Create a notebook in the Azure Databricks workspace, and provide the path to that notebook as the value associated with the environment variable \"DATABRICKS_NOTEBOOK_PATH\". This will then set the variable\u00c2\u00a0notebook_path\u00c2\u00a0when you run the code cell below:\n",
|
"Create a notebook in the Azure Databricks workspace, and provide the path to that notebook as the value associated with the environment variable \"DATABRICKS_NOTEBOOK_PATH\". This will then set the variable\u00c2\u00a0notebook_path\u00c2\u00a0when you run the code cell below:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"your notebook's path in Azure Databricks UI by hovering over to notebook's title. A typical path of notebook looks like this `/Users/example@databricks.com/example`. See [Databricks Workspace](https://docs.azuredatabricks.net/user-guide/workspace.html) to learn about the folder structure.\n",
|
"your notebook's path in Azure Databricks UI by hovering over to notebook's title. A typical path of notebook looks like this `/Users/example@databricks.com/example`. See [Databricks Workspace](https://docs.microsoft.com/azure/databricks/workspace) to learn about the folder structure.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Note: DataPath `PipelineParameter` should be provided in list of inputs. Such parameters can be accessed by the datapath `name`."
|
"Note: DataPath `PipelineParameter` should be provided in list of inputs. Such parameters can be accessed by the datapath `name`."
|
||||||
]
|
]
|
||||||
@@ -487,7 +486,7 @@
|
|||||||
"### 2. Running a Python script from DBFS\n",
|
"### 2. Running a Python script from DBFS\n",
|
||||||
"This shows how to run a Python script in DBFS. \n",
|
"This shows how to run a Python script in DBFS. \n",
|
||||||
"\n",
|
"\n",
|
||||||
"To complete this, you will need to first upload the Python script in your local machine to DBFS using the [CLI](https://docs.azuredatabricks.net/user-guide/dbfs-databricks-file-system.html). The CLI command is given below:\n",
|
"To complete this, you will need to first upload the Python script in your local machine to DBFS using the [CLI](https://docs.microsoft.com/azure/databricks/dbfs). The CLI command is given below:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"```\n",
|
"```\n",
|
||||||
"dbfs cp ./train-db-dbfs.py dbfs:/train-db-dbfs.py\n",
|
"dbfs cp ./train-db-dbfs.py dbfs:/train-db-dbfs.py\n",
|
||||||
@@ -630,7 +629,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"### 4. Running a JAR job that is alreay added in DBFS\n",
|
"### 4. Running a JAR job that is alreay added in DBFS\n",
|
||||||
"To run a JAR job that is already uploaded to DBFS, follow the instructions below. You will first upload the JAR file to DBFS using the [CLI](https://docs.azuredatabricks.net/user-guide/dbfs-databricks-file-system.html).\n",
|
"To run a JAR job that is already uploaded to DBFS, follow the instructions below. You will first upload the JAR file to DBFS using the [CLI](https://docs.microsoft.com/azure/databricks/dbfs).\n",
|
||||||
"\n",
|
"\n",
|
||||||
"The commented out code in the below cell assumes that you have uploaded `train-db-dbfs.jar` to the root folder in DBFS. You can upload `train-db-dbfs.jar` to the root folder in DBFS using this commandline so you can use `jar_library_dbfs_path = \"dbfs:/train-db-dbfs.jar\"`:\n",
|
"The commented out code in the below cell assumes that you have uploaded `train-db-dbfs.jar` to the root folder in DBFS. You can upload `train-db-dbfs.jar` to the root folder in DBFS using this commandline so you can use `jar_library_dbfs_path = \"dbfs:/train-db-dbfs.jar\"`:\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -704,7 +703,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"### 5. Running demo notebook already added to the Databricks workspace using existing cluster\n",
|
"### 5. Running demo notebook already added to the Databricks workspace using existing cluster\n",
|
||||||
"First you need register DBFS datastore and make sure path_on_datastore does exist in databricks file system, you can browser the files by refering [this](https://docs.azuredatabricks.net/user-guide/dbfs-databricks-file-system.html).\n",
|
"First you need register DBFS datastore and make sure path_on_datastore does exist in databricks file system, you can browser the files by refering [this](https://docs.microsoft.com/azure/databricks/dbfs).\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Find existing_cluster_id by opeing Azure Databricks UI with Clusters page and in url you will find a string connected with '-' right after \"clusters/\"."
|
"Find existing_cluster_id by opeing Azure Databricks UI with Clusters page and in url you will find a string connected with '-' right after \"clusters/\"."
|
||||||
]
|
]
|
||||||
@@ -941,9 +940,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "How to use DatabricksStep with AML Pipelines",
|
"friendly_name": "How to use DatabricksStep with AML Pipelines",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -244,9 +244,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "How to use KustoStep with AML Pipelines",
|
"friendly_name": "How to use KustoStep with AML Pipelines",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -498,9 +498,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "How to use AutoMLStep with AML Pipelines",
|
"friendly_name": "How to use AutoMLStep with AML Pipelines",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -315,9 +315,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "Azure Machine Learning Pipeline with CommandStep for R",
|
"friendly_name": "Azure Machine Learning Pipeline with CommandStep for R",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -278,9 +278,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "Azure Machine Learning Pipeline with CommandStep",
|
"friendly_name": "Azure Machine Learning Pipeline with CommandStep",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -252,7 +252,7 @@
|
|||||||
"# is_directory=None)\n",
|
"# is_directory=None)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Naming the intermediate data as processed_data1 and assigning it to the variable processed_data1.\n",
|
"# Naming the intermediate data as processed_data1 and assigning it to the variable processed_data1.\n",
|
||||||
"processed_data1 = PipelineData(\"processed_data1\",datastore=def_blob_store)\n",
|
"processed_data1 = PipelineData(\"processed_data1\",datastore=def_blob_store, is_directory=True)\n",
|
||||||
"print(\"PipelineData object created\")"
|
"print(\"PipelineData object created\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -347,7 +347,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"# step5 to use the intermediate data produced by step4\n",
|
"# step5 to use the intermediate data produced by step4\n",
|
||||||
"# This step also produces an output processed_data2\n",
|
"# This step also produces an output processed_data2\n",
|
||||||
"processed_data2 = PipelineData(\"processed_data2\", datastore=def_blob_store)\n",
|
"processed_data2 = PipelineData(\"processed_data2\", datastore=def_blob_store, is_directory=True)\n",
|
||||||
"source_directory = \"data_dependency_run_extract\"\n",
|
"source_directory = \"data_dependency_run_extract\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"extractStep = PythonScriptStep(\n",
|
"extractStep = PythonScriptStep(\n",
|
||||||
@@ -394,7 +394,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# Now define the compare step which takes two inputs and produces an output\n",
|
"# Now define the compare step which takes two inputs and produces an output\n",
|
||||||
"processed_data3 = PipelineData(\"processed_data3\", datastore=def_blob_store)\n",
|
"processed_data3 = PipelineData(\"processed_data3\", datastore=def_blob_store, is_directory=True)\n",
|
||||||
"source_directory = \"data_dependency_run_compare\"\n",
|
"source_directory = \"data_dependency_run_compare\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"compareStep = PythonScriptStep(\n",
|
"compareStep = PythonScriptStep(\n",
|
||||||
@@ -545,9 +545,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "Azure Machine Learning Pipelines with Data Dependency",
|
"friendly_name": "Azure Machine Learning Pipelines with Data Dependency",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -235,7 +235,8 @@
|
|||||||
" path_on_datastore=\"titanic/Titanic.csv\")\n",
|
" path_on_datastore=\"titanic/Titanic.csv\")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"output_data = PipelineData(name=\"processed_data\",\n",
|
"output_data = PipelineData(name=\"processed_data\",\n",
|
||||||
" datastore=Datastore.get(ws, \"workspaceblobstore\"))"
|
" datastore=Datastore.get(ws, \"workspaceblobstore\"),\n",
|
||||||
|
" is_directory=True)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -306,7 +307,8 @@
|
|||||||
"from azureml.pipeline.core import PipelineParameter\n",
|
"from azureml.pipeline.core import PipelineParameter\n",
|
||||||
"\n",
|
"\n",
|
||||||
"output_from_notebook = PipelineData(name=\"notebook_processed_data\",\n",
|
"output_from_notebook = PipelineData(name=\"notebook_processed_data\",\n",
|
||||||
" datastore=Datastore.get(ws, \"workspaceblobstore\"))\n",
|
" datastore=Datastore.get(ws, \"workspaceblobstore\"),\n",
|
||||||
|
" is_directory=True)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"my_pipeline_param = PipelineParameter(name=\"pipeline_param\", default_value=\"my_param\")\n",
|
"my_pipeline_param = PipelineParameter(name=\"pipeline_param\", default_value=\"my_param\")\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -409,9 +411,9 @@
|
|||||||
],
|
],
|
||||||
"friendly_name": "How to use run a notebook as a step in AML Pipelines",
|
"friendly_name": "How to use run a notebook as a step in AML Pipelines",
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# DisableDockerDetector "Disabled to unblock PRs until the owner can fix the file. Not used in any prod deployments - only as a documentation for the customers"
|
# DisableDockerDetector "Disabled to unblock PRs until the owner can fix the file. Not used in any prod deployments - only as a documentation for the customers"
|
||||||
FROM rocker/tidyverse:4.0.0-ubuntu18.04
|
FROM rocker/tidyverse:4.0.0-ubuntu20.04
|
||||||
|
|
||||||
# Install python
|
# Install python
|
||||||
RUN apt-get update -qq && \
|
RUN apt-get update -qq && \
|
||||||
|
|||||||
@@ -84,9 +84,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -363,7 +363,7 @@
|
|||||||
"}).replace(\",\", \";\")\n",
|
"}).replace(\",\", \";\")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Define output after cleansing step\n",
|
"# Define output after cleansing step\n",
|
||||||
"cleansed_green_data = PipelineData(\"cleansed_green_data\", datastore=default_store).as_dataset()\n",
|
"cleansed_green_data = PipelineData(\"cleansed_green_data\", datastore=default_store, is_directory=True).as_dataset()\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print('Cleanse script is in {}.'.format(os.path.realpath(prepare_data_folder)))\n",
|
"print('Cleanse script is in {}.'.format(os.path.realpath(prepare_data_folder)))\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -414,7 +414,7 @@
|
|||||||
"}).replace(\",\", \";\")\n",
|
"}).replace(\",\", \";\")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Define output after cleansing step\n",
|
"# Define output after cleansing step\n",
|
||||||
"cleansed_yellow_data = PipelineData(\"cleansed_yellow_data\", datastore=default_store).as_dataset()\n",
|
"cleansed_yellow_data = PipelineData(\"cleansed_yellow_data\", datastore=default_store, is_directory=True).as_dataset()\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print('Cleanse script is in {}.'.format(os.path.realpath(prepare_data_folder)))\n",
|
"print('Cleanse script is in {}.'.format(os.path.realpath(prepare_data_folder)))\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -452,7 +452,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# Define output after merging step\n",
|
"# Define output after merging step\n",
|
||||||
"merged_data = PipelineData(\"merged_data\", datastore=default_store).as_dataset()\n",
|
"merged_data = PipelineData(\"merged_data\", datastore=default_store, is_directory=True).as_dataset()\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print('Merge script is in {}.'.format(os.path.realpath(prepare_data_folder)))\n",
|
"print('Merge script is in {}.'.format(os.path.realpath(prepare_data_folder)))\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -489,7 +489,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# Define output after merging step\n",
|
"# Define output after merging step\n",
|
||||||
"filtered_data = PipelineData(\"filtered_data\", datastore=default_store).as_dataset()\n",
|
"filtered_data = PipelineData(\"filtered_data\", datastore=default_store, is_directory=True).as_dataset()\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print('Filter script is in {}.'.format(os.path.realpath(prepare_data_folder)))\n",
|
"print('Filter script is in {}.'.format(os.path.realpath(prepare_data_folder)))\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -525,7 +525,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# Define output after normalize step\n",
|
"# Define output after normalize step\n",
|
||||||
"normalized_data = PipelineData(\"normalized_data\", datastore=default_store).as_dataset()\n",
|
"normalized_data = PipelineData(\"normalized_data\", datastore=default_store, is_directory=True).as_dataset()\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print('Normalize script is in {}.'.format(os.path.realpath(prepare_data_folder)))\n",
|
"print('Normalize script is in {}.'.format(os.path.realpath(prepare_data_folder)))\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -566,7 +566,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# Define output after transform step\n",
|
"# Define output after transform step\n",
|
||||||
"transformed_data = PipelineData(\"transformed_data\", datastore=default_store).as_dataset()\n",
|
"transformed_data = PipelineData(\"transformed_data\", datastore=default_store, is_directory=True).as_dataset()\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print('Transform script is in {}.'.format(os.path.realpath(prepare_data_folder)))\n",
|
"print('Transform script is in {}.'.format(os.path.realpath(prepare_data_folder)))\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -604,8 +604,8 @@
|
|||||||
"train_model_folder = './scripts/trainmodel'\n",
|
"train_model_folder = './scripts/trainmodel'\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# train and test splits output\n",
|
"# train and test splits output\n",
|
||||||
"output_split_train = PipelineData(\"output_split_train\", datastore=default_store).as_dataset()\n",
|
"output_split_train = PipelineData(\"output_split_train\", datastore=default_store, is_directory=True).as_dataset()\n",
|
||||||
"output_split_test = PipelineData(\"output_split_test\", datastore=default_store).as_dataset()\n",
|
"output_split_test = PipelineData(\"output_split_test\", datastore=default_store, is_directory=True).as_dataset()\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print('Data spilt script is in {}.'.format(os.path.realpath(train_model_folder)))\n",
|
"print('Data spilt script is in {}.'.format(os.path.realpath(train_model_folder)))\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -1046,9 +1046,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
"In this notebook, we will demonstrate how to make predictions on large quantities of data asynchronously using the ML pipelines with Azure Machine Learning. Batch inference (or batch scoring) provides cost-effective inference, with unparalleled throughput for asynchronous applications. Batch prediction pipelines can scale to perform inference on terabytes of production data. Batch prediction is optimized for high throughput, fire-and-forget predictions for a large collection of data.\n",
|
"In this notebook, we will demonstrate how to make predictions on large quantities of data asynchronously using the ML pipelines with Azure Machine Learning. Batch inference (or batch scoring) provides cost-effective inference, with unparalleled throughput for asynchronous applications. Batch prediction pipelines can scale to perform inference on terabytes of production data. Batch prediction is optimized for high throughput, fire-and-forget predictions for a large collection of data.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"> **Tip**\n",
|
"> **Tip**\n",
|
||||||
"If your system requires low-latency processing (to process a single document or small set of documents quickly), use [real-time scoring](https://docs.microsoft.com/azure/machine-learning/service/how-to-consume-web-service) instead of batch prediction.\n",
|
"If your system requires low-latency processing (to process a single document or small set of documents quickly), use [real-time scoring](https://docs.microsoft.com/azure/machine-learning/v1/how-to-consume-web-service) instead of batch prediction.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"In this example will be take a digit identification model already-trained on MNIST dataset using the [AzureML training with deep learning example notebook](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/ml-frameworks/keras/train-hyperparameter-tune-deploy-with-keras/train-hyperparameter-tune-deploy-with-keras.ipynb), and run that trained model on some of the MNIST test images in batch. \n",
|
"In this example will be take a digit identification model already-trained on MNIST dataset using the [AzureML training with deep learning example notebook](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/ml-frameworks/keras/train-hyperparameter-tune-deploy-with-keras/train-hyperparameter-tune-deploy-with-keras.ipynb), and run that trained model on some of the MNIST test images in batch. \n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -277,7 +277,7 @@
|
|||||||
"### Register the model with Workspace\n",
|
"### Register the model with Workspace\n",
|
||||||
"A registered model is a logical container for one or more files that make up your model. For example, if you have a model that's stored in multiple files, you can register them as a single model in the workspace. After you register the files, you can then download or deploy the registered model and receive all the files that you registered.\n",
|
"A registered model is a logical container for one or more files that make up your model. For example, if you have a model that's stored in multiple files, you can register them as a single model in the workspace. After you register the files, you can then download or deploy the registered model and receive all the files that you registered.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Using tags, you can track useful information such as the name and version of the machine learning library used to train the model. Note that tags must be alphanumeric. Learn more about registering models [here](https://docs.microsoft.com/azure/machine-learning/service/how-to-deploy-and-where#registermodel) "
|
"Using tags, you can track useful information such as the name and version of the machine learning library used to train the model. Note that tags must be alphanumeric. Learn more about registering models [here](https://docs.microsoft.com/azure/machine-learning/v1/how-to-deploy-and-where#registermodel) "
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -581,16 +581,7 @@
|
|||||||
"metadata": {
|
"metadata": {
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "joringer"
|
"name": "prsbjdev"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "asraniwa"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "pansav"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "tracych"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"category": "Other notebooks",
|
"category": "Other notebooks",
|
||||||
@@ -610,9 +601,9 @@
|
|||||||
"friendly_name": "MNIST data inferencing using ParallelRunStep",
|
"friendly_name": "MNIST data inferencing using ParallelRunStep",
|
||||||
"index_order": 1,
|
"index_order": 1,
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.6",
|
"display_name": "Python 3.8 - AzureML",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python36"
|
"name": "python38-azureml"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user