Skip to content

Commit

Permalink
update samples from Release-42 as a part of SDK release
Browse files Browse the repository at this point in the history
  • Loading branch information
vizhur committed Mar 20, 2020
1 parent e0ea99a commit 59fcb54
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 246 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dependencies:
- py-xgboost<=0.80
- pip:
- azureml-sdk
- numpy==1.16.2
- azureml-train-automl
- azureml-widgets
- matplotlib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dependencies:
- py-xgboost<=0.80
- pip:
- azureml-sdk
- numpy==1.16.2
- azureml-train-automl
- azureml-widgets
- matplotlib
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: auto-ml-forecasting-energy-demand
dependencies:
- pip:
- azureml-sdk
- numpy==1.16.2
- azureml-train-automl
- azureml-widgets
- matplotlib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@
"metadata": {
"authors": [
{
"name": "erwright, nirovins"
"name": "erwright"
}
],
"category": "tutorial",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dependencies:
- py-xgboost<=0.80
- pip:
- azureml-sdk
- numpy==1.16.2
- azureml-train-automl
- azureml-widgets
- matplotlib
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dependencies:
- py-xgboost<=0.80
- pip:
- azureml-sdk
- numpy==1.16.2
- pandas==0.23.4
- azureml-train-automl
- azureml-widgets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
"\n",
"## Prerequisites\n",
"\n",
"See prerequisites in the [Azure Machine Learning documentation](https://docs.microsoft.com/azure/machine-learning/service/tutorial-train-models-with-aml#prerequisites)."
"See prerequisites in the [Azure Machine Learning documentation](https://docs.microsoft.com/azure/machine-learning/service/tutorial-train-models-with-aml#prerequisites).\n",
"\n",
"On the computer running this notebook, conda install matplotlib, numpy, scikit-learn=0.22.1"
]
},
{
Expand Down Expand Up @@ -309,7 +311,7 @@
"import glob\n",
"\n",
"from sklearn.linear_model import LogisticRegression\n",
"from sklearn.externals import joblib\n",
"import joblib\n",
"\n",
"from azureml.core import Run\n",
"from utils import load_data\n",
Expand Down Expand Up @@ -397,15 +399,20 @@
"source": [
"### Create an estimator\n",
"\n",
"An estimator object is used to submit the run. Azure Machine Learning has pre-configured estimators for common machine learning frameworks, as well as generic Estimator. Create SKLearn estimator for scikit-learn model, by specifying\n",
"An estimator object is used to submit the run. Azure Machine Learning has pre-configured estimators for common machine learning frameworks, as well as generic Estimator. Create an estimator by specifying\n",
"\n",
"* The name of the estimator object, `est`\n",
"* The directory that contains your scripts. All the files in this directory are uploaded into the cluster nodes for execution. \n",
"* The compute target. In this case you will use the AmlCompute you created\n",
"* The training script name, train.py\n",
"* Parameters required from the training script \n",
"* An environment that contains the libraries needed to run the script\n",
"* Parameters required from the training script. \n",
"\n",
"In this tutorial, the target is AmlCompute. All files in the script folder are uploaded into the cluster nodes for execution. The data_folder is set to use the dataset.\n",
"\n",
"First, create the environment that contains: the scikit-learn library, azureml-dataprep required for accessing the dataset, and azureml-defaults which contains the dependencies for logging metrics. The azureml-defaults also contains the dependencies required for deploying the model as a web service later in the part 2 of the tutorial.\n",
"\n",
"In this tutorial, the target is AmlCompute. All files in the script folder are uploaded into the cluster nodes for execution. The data_folder is set to use the dataset."
"Once the environment is defined, register it with the Workspace to re-use it in part 2 of the tutorial."
]
},
{
Expand All @@ -418,10 +425,20 @@
"from azureml.core.conda_dependencies import CondaDependencies\n",
"\n",
"# to install required packages\n",
"env = Environment('my_env')\n",
"cd = CondaDependencies.create(pip_packages=['azureml-sdk','scikit-learn==0.22.1','azureml-dataprep[pandas,fuse]>=1.1.14'])\n",
"env = Environment('tutorial-env')\n",
"cd = CondaDependencies.create(pip_packages=['azureml-dataprep[pandas,fuse]>=1.1.14', 'azureml-defaults'], conda_packages = ['scikit-learn==0.22.1'])\n",
"\n",
"env.python.conda_dependencies = cd"
"env.python.conda_dependencies = cd\n",
"\n",
"# Register environment to re-use later\n",
"env.register(workspace = ws)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Then, create the estimator by specifying the training script, compute target and environment."
]
},
{
Expand All @@ -434,15 +451,15 @@
},
"outputs": [],
"source": [
"from azureml.train.sklearn import SKLearn\n",
"from azureml.train.estimator import Estimator\n",
"\n",
"script_params = {\n",
" # to mount files referenced by mnist dataset\n",
" '--data-folder': mnist_file_dataset.as_named_input('mnist_opendataset').as_mount(),\n",
" '--regularization': 0.5\n",
"}\n",
"\n",
"est = SKLearn(source_directory=script_folder,\n",
"est = Estimator(source_directory=script_folder,\n",
" script_params=script_params,\n",
" compute_target=compute_target,\n",
" environment_definition=env,\n",
Expand Down Expand Up @@ -667,7 +684,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.7.6"
},
"msauthor": "roastala"
},
Expand Down
Loading

0 comments on commit 59fcb54

Please sign in to comment.