Skip to content

Instantly share code, notes, and snippets.

@CM-Mr-Mo
Last active July 13, 2020 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CM-Mr-Mo/311c3c16e126a7610cb14338e70302b1 to your computer and use it in GitHub Desktop.
Save CM-Mr-Mo/311c3c16e126a7610cb14338e70302b1 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"tags": []
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": "AzureML SDK Version: 1.9.0\n"
}
],
"source": [
"import azureml.core\n",
"import pandas as pd\n",
"import numpy as np\n",
"import logging\n",
"\n",
"print(\"AzureML SDK Version: \", azureml.core.VERSION)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from azureml.core import Workspace, Experiment\n",
"\n",
"# aml_config か config.json が必要\n",
"ws = Workspace.from_config()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": " instant date season yr mnth weekday weathersit temp \\\n0 1 2011-01-01 1 0 1 6 2 0.344167 \n1 2 2011-01-02 1 0 1 0 2 0.363478 \n2 3 2011-01-03 1 0 1 1 1 0.196364 \n3 4 2011-01-04 1 0 1 2 1 0.200000 \n4 5 2011-01-05 1 0 1 3 1 0.226957 \n\n atemp hum windspeed casual registered cnt \n0 0.363625 0.805833 0.160446 331 654 985 \n1 0.353739 0.696087 0.248539 131 670 801 \n2 0.189405 0.437273 0.248309 120 1229 1349 \n3 0.212122 0.590435 0.160296 108 1454 1562 \n4 0.229270 0.436957 0.186900 82 1518 1600 ",
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>instant</th>\n <th>date</th>\n <th>season</th>\n <th>yr</th>\n <th>mnth</th>\n <th>weekday</th>\n <th>weathersit</th>\n <th>temp</th>\n <th>atemp</th>\n <th>hum</th>\n <th>windspeed</th>\n <th>casual</th>\n <th>registered</th>\n <th>cnt</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>1</td>\n <td>2011-01-01</td>\n <td>1</td>\n <td>0</td>\n <td>1</td>\n <td>6</td>\n <td>2</td>\n <td>0.344167</td>\n <td>0.363625</td>\n <td>0.805833</td>\n <td>0.160446</td>\n <td>331</td>\n <td>654</td>\n <td>985</td>\n </tr>\n <tr>\n <th>1</th>\n <td>2</td>\n <td>2011-01-02</td>\n <td>1</td>\n <td>0</td>\n <td>1</td>\n <td>0</td>\n <td>2</td>\n <td>0.363478</td>\n <td>0.353739</td>\n <td>0.696087</td>\n <td>0.248539</td>\n <td>131</td>\n <td>670</td>\n <td>801</td>\n </tr>\n <tr>\n <th>2</th>\n <td>3</td>\n <td>2011-01-03</td>\n <td>1</td>\n <td>0</td>\n <td>1</td>\n <td>1</td>\n <td>1</td>\n <td>0.196364</td>\n <td>0.189405</td>\n <td>0.437273</td>\n <td>0.248309</td>\n <td>120</td>\n <td>1229</td>\n <td>1349</td>\n </tr>\n <tr>\n <th>3</th>\n <td>4</td>\n <td>2011-01-04</td>\n <td>1</td>\n <td>0</td>\n <td>1</td>\n <td>2</td>\n <td>1</td>\n <td>0.200000</td>\n <td>0.212122</td>\n <td>0.590435</td>\n <td>0.160296</td>\n <td>108</td>\n <td>1454</td>\n <td>1562</td>\n </tr>\n <tr>\n <th>4</th>\n <td>5</td>\n <td>2011-01-05</td>\n <td>1</td>\n <td>0</td>\n <td>1</td>\n <td>3</td>\n <td>1</td>\n <td>0.226957</td>\n <td>0.229270</td>\n <td>0.436957</td>\n <td>0.186900</td>\n <td>82</td>\n <td>1518</td>\n <td>1600</td>\n </tr>\n </tbody>\n</table>\n</div>"
},
"metadata": {},
"execution_count": 6
}
],
"source": [
"from azureml.core import Dataset\n",
"\n",
"time_column_name = 'date'\n",
"\n",
"dataset = Dataset.get_by_name(workspace=ws,name='MyWorkSp-data').with_timestamp_columns(fine_grain_timestamp=time_column_name)\n",
"dataset.take(5).to_pandas_dataframe().reset_index(drop=True)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": " instant date season yr mnth weekday weathersit temp \\\n0 605 2012-08-27 3 1 8 1 1 0.703333 \n1 606 2012-08-28 3 1 8 2 1 0.728333 \n2 607 2012-08-29 3 1 8 3 1 0.685000 \n3 608 2012-08-30 3 1 8 4 1 0.706667 \n4 609 2012-08-31 3 1 8 5 1 0.764167 \n\n atemp hum windspeed casual registered cnt \n0 0.654688 0.730417 0.128733 989 5928 6917 \n1 0.666050 0.620000 0.190925 935 6105 7040 \n2 0.635733 0.552083 0.112562 1177 6520 7697 \n3 0.652779 0.590417 0.077117 1172 6541 7713 \n4 0.689400 0.587500 0.168533 1433 5917 7350 ",
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>instant</th>\n <th>date</th>\n <th>season</th>\n <th>yr</th>\n <th>mnth</th>\n <th>weekday</th>\n <th>weathersit</th>\n <th>temp</th>\n <th>atemp</th>\n <th>hum</th>\n <th>windspeed</th>\n <th>casual</th>\n <th>registered</th>\n <th>cnt</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>605</td>\n <td>2012-08-27</td>\n <td>3</td>\n <td>1</td>\n <td>8</td>\n <td>1</td>\n <td>1</td>\n <td>0.703333</td>\n <td>0.654688</td>\n <td>0.730417</td>\n <td>0.128733</td>\n <td>989</td>\n <td>5928</td>\n <td>6917</td>\n </tr>\n <tr>\n <th>1</th>\n <td>606</td>\n <td>2012-08-28</td>\n <td>3</td>\n <td>1</td>\n <td>8</td>\n <td>2</td>\n <td>1</td>\n <td>0.728333</td>\n <td>0.666050</td>\n <td>0.620000</td>\n <td>0.190925</td>\n <td>935</td>\n <td>6105</td>\n <td>7040</td>\n </tr>\n <tr>\n <th>2</th>\n <td>607</td>\n <td>2012-08-29</td>\n <td>3</td>\n <td>1</td>\n <td>8</td>\n <td>3</td>\n <td>1</td>\n <td>0.685000</td>\n <td>0.635733</td>\n <td>0.552083</td>\n <td>0.112562</td>\n <td>1177</td>\n <td>6520</td>\n <td>7697</td>\n </tr>\n <tr>\n <th>3</th>\n <td>608</td>\n <td>2012-08-30</td>\n <td>3</td>\n <td>1</td>\n <td>8</td>\n <td>4</td>\n <td>1</td>\n <td>0.706667</td>\n <td>0.652779</td>\n <td>0.590417</td>\n <td>0.077117</td>\n <td>1172</td>\n <td>6541</td>\n <td>7713</td>\n </tr>\n <tr>\n <th>4</th>\n <td>609</td>\n <td>2012-08-31</td>\n <td>3</td>\n <td>1</td>\n <td>8</td>\n <td>5</td>\n <td>1</td>\n <td>0.764167</td>\n <td>0.689400</td>\n <td>0.587500</td>\n <td>0.168533</td>\n <td>1433</td>\n <td>5917</td>\n <td>7350</td>\n </tr>\n </tbody>\n</table>\n</div>"
},
"metadata": {},
"execution_count": 7
}
],
"source": [
"from datetime import datetime\n",
"train = dataset.time_before(datetime(2012,8,31), include_boundary=True)\n",
"train.to_pandas_dataframe().tail(5).reset_index(drop=True)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": " instant date season yr mnth weekday weathersit temp \\\n0 610 2012-09-01 3 1 9 6 2 0.753333 \n1 611 2012-09-02 3 1 9 0 2 0.696667 \n2 612 2012-09-03 3 1 9 1 1 0.707500 \n3 613 2012-09-04 3 1 9 2 1 0.725833 \n4 614 2012-09-05 3 1 9 3 1 0.736667 \n\n atemp hum windspeed casual registered cnt \n0 0.702654 0.638333 0.113187 2352 3788 6140 \n1 0.649000 0.815000 0.064071 2613 3197 5810 \n2 0.661629 0.790833 0.151121 1965 4069 6034 \n3 0.686888 0.755000 0.236321 867 5997 6864 \n4 0.708983 0.741250 0.187808 832 6280 7112 ",
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>instant</th>\n <th>date</th>\n <th>season</th>\n <th>yr</th>\n <th>mnth</th>\n <th>weekday</th>\n <th>weathersit</th>\n <th>temp</th>\n <th>atemp</th>\n <th>hum</th>\n <th>windspeed</th>\n <th>casual</th>\n <th>registered</th>\n <th>cnt</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>610</td>\n <td>2012-09-01</td>\n <td>3</td>\n <td>1</td>\n <td>9</td>\n <td>6</td>\n <td>2</td>\n <td>0.753333</td>\n <td>0.702654</td>\n <td>0.638333</td>\n <td>0.113187</td>\n <td>2352</td>\n <td>3788</td>\n <td>6140</td>\n </tr>\n <tr>\n <th>1</th>\n <td>611</td>\n <td>2012-09-02</td>\n <td>3</td>\n <td>1</td>\n <td>9</td>\n <td>0</td>\n <td>2</td>\n <td>0.696667</td>\n <td>0.649000</td>\n <td>0.815000</td>\n <td>0.064071</td>\n <td>2613</td>\n <td>3197</td>\n <td>5810</td>\n </tr>\n <tr>\n <th>2</th>\n <td>612</td>\n <td>2012-09-03</td>\n <td>3</td>\n <td>1</td>\n <td>9</td>\n <td>1</td>\n <td>1</td>\n <td>0.707500</td>\n <td>0.661629</td>\n <td>0.790833</td>\n <td>0.151121</td>\n <td>1965</td>\n <td>4069</td>\n <td>6034</td>\n </tr>\n <tr>\n <th>3</th>\n <td>613</td>\n <td>2012-09-04</td>\n <td>3</td>\n <td>1</td>\n <td>9</td>\n <td>2</td>\n <td>1</td>\n <td>0.725833</td>\n <td>0.686888</td>\n <td>0.755000</td>\n <td>0.236321</td>\n <td>867</td>\n <td>5997</td>\n <td>6864</td>\n </tr>\n <tr>\n <th>4</th>\n <td>614</td>\n <td>2012-09-05</td>\n <td>3</td>\n <td>1</td>\n <td>9</td>\n <td>3</td>\n <td>1</td>\n <td>0.736667</td>\n <td>0.708983</td>\n <td>0.741250</td>\n <td>0.187808</td>\n <td>832</td>\n <td>6280</td>\n <td>7112</td>\n </tr>\n </tbody>\n</table>\n</div>"
},
"metadata": {},
"execution_count": 8
}
],
"source": [
"test = dataset.time_after(datetime(2012,9,1), include_boundary=True)\n",
"test.to_pandas_dataframe().head(5).reset_index(drop=True)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"from azureml.core.compute import ComputeTarget\n",
"\n",
"compute_target = ComputeTarget(workspace=ws, name='MyCluster')"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"from azureml.train.automl import AutoMLConfig\n",
"from azureml.train.automl.constants import Tasks, SupportedModels\n",
"\n",
"target_column_name = 'cnt'\n",
"\n",
"time_series_settings = {\n",
" 'time_column_name': time_column_name,\n",
" 'max_horizon': 14,\n",
" 'country_or_region': 'JP',\n",
" 'target_lags': 'auto',\n",
" 'drop_column_names': ['casual', 'registered']\n",
"}\n",
"\n",
"automl_config = AutoMLConfig(task=Tasks.FORECASTING,\n",
" primary_metric='normalized_root_mean_squared_error',\n",
" blacklist_models=[SupportedModels.Classification.ExtraTrees],\n",
" experiment_timeout_minutes=30,\n",
" training_data=train,\n",
" label_column_name=target_column_name,\n",
" compute_target=compute_target,\n",
" enable_early_stopping=True,\n",
" n_cross_validations=3,\n",
" max_concurrent_iterations=4,\n",
" max_cores_per_iteration=-1,\n",
" verbosity=logging.INFO,\n",
" **time_series_settings)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"tags": []
},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": "WARNING - Using different time series parameters in AutoML configs for forecasting tasks will be deprecated, please use ForecastingParameters class instead.\nWARNING - Forecasting parameter max_horizon will be deprecated in the future, please use forecast_horizon instead.\nWARNING - Forecasting parameter country_or_region will be deprecated in the future, please use holiday_country instead.\nRunning on remote or ADB.\n"
},
{
"output_type": "execute_result",
"data": {
"text/plain": "Run(Experiment: MyWorkSp-exp,\nId: AutoML_b963fb5c-8ab2-4914-9ef3-98951049e463,\nType: automl,\nStatus: NotStarted)",
"text/html": "<table style=\"width:100%\"><tr><th>Experiment</th><th>Id</th><th>Type</th><th>Status</th><th>Details Page</th><th>Docs Page</th></tr><tr><td>MyWorkSp-exp</td><td>AutoML_b963fb5c-8ab2-4914-9ef3-98951049e463</td><td>automl</td><td>NotStarted</td><td><a href=\"https://ml.azure.com/experiments/MyWorkSp-exp/runs/AutoML_b963fb5c-8ab2-4914-9ef3-98951049e463?wsid=/subscriptions/3de1cda7-0778-4934-83d4-d423f8ccde1d/resourcegroups/MyWorkSp-rg/workspaces/MyWorkSp\" target=\"_blank\" rel=\"noopener\">Link to Azure Machine Learning studio</a></td><td><a href=\"https://docs.microsoft.com/en-us/python/api/overview/azure/ml/intro?view=azure-ml-py\" target=\"_blank\" rel=\"noopener\">Link to Documentation</a></td></tr></table>"
},
"metadata": {},
"execution_count": 11
}
],
"source": [
"from azureml.core import Experiment\n",
"\n",
"experiment = Experiment(workspace=ws, name='MyWorkSp-exp')\n",
"remote_run = experiment.submit(automl_config, show_output=False)\n",
"remote_run"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": "{'runId': 'AutoML_b963fb5c-8ab2-4914-9ef3-98951049e463',\n 'target': 'MyCluster',\n 'status': 'Completed',\n 'startTimeUtc': '2020-07-12T15:29:18.634492Z',\n 'endTimeUtc': '2020-07-12T15:44:21.932152Z',\n 'properties': {'num_iterations': '1000',\n 'training_type': 'TrainFull',\n 'acquisition_function': 'EI',\n 'primary_metric': 'normalized_root_mean_squared_error',\n 'train_split': '0',\n 'acquisition_parameter': '0',\n 'num_cross_validation': '3',\n 'target': 'MyCluster',\n 'RawAMLSettingsString': \"{'path': '/home/codespace/workspace/c9-dev-intro-data-science/regression-with-bikes', 'name': 'MyWorkSp-exp', 'subscription_id': '3de1cda7-0778-4934-83d4-d423f8ccde1d', 'resource_group': 'MyWorkSp-rg', 'workspace_name': 'MyWorkSp', 'region': 'japaneast', 'compute_target': 'MyCluster', 'spark_service': None, 'azure_service': 'remote', '_local_managed_run_id': None, 'iterations': 1000, 'primary_metric': 'normalized_root_mean_squared_error', 'task_type': 'regression', 'data_script': None, 'validation_size': 0.0, 'n_cross_validations': 3, 'y_min': None, 'y_max': None, 'num_classes': None, 'featurization': 'auto', '_ignore_package_version_incompatibilities': False, 'is_timeseries': True, 'max_cores_per_iteration': -1, 'max_concurrent_iterations': 4, 'iteration_timeout_minutes': None, 'mem_in_mb': None, 'enforce_time_on_windows': False, 'experiment_timeout_minutes': 30, 'experiment_exit_score': None, 'whitelist_models': None, 'blacklist_algos': ['ExtremeRandomTrees'], 'supported_models': ['ElasticNet', 'ExtremeRandomTrees', 'DecisionTree', 'AutoArima', 'SGD', 'XGBoostRegressor', 'LassoLars', 'RandomForest', 'KNN', 'LightGBM', 'TensorFlowDNN', 'Prophet', 'TCNForecaster', 'GradientBoosting', 'TensorFlowLinearRegressor'], 'auto_blacklist': True, 'blacklist_samples_reached': False, 'exclude_nan_labels': True, 'verbosity': 20, '_debug_log': 'azureml_automl.log', 'show_warnings': False, 'model_explainability': True, 'service_url': None, 'sdk_url': None, 'sdk_packages': None, 'enable_onnx_compatible_models': False, 'enable_split_onnx_featurizer_estimator_models': False, 'vm_type': 'STANDARD_D1_V2', 'telemetry_verbosity': 20, 'send_telemetry': True, 'enable_dnn': False, 'force_text_dnn': False, 'enable_feature_sweeping': False, 'time_column_name': 'date', 'grain_column_names': None, 'drop_column_names': ['casual', 'registered'], 'max_horizon': 14, 'dropna': False, 'overwrite_columns': True, 'transform_dictionary': {'min': '_automl_target_col', 'max': '_automl_target_col', 'mean': '_automl_target_col'}, 'window_size': None, 'country_or_region': 'JP', 'lags': {'_automl_target_col': ['auto']}, 'feature_lags': None, 'seasonality': -1, 'use_stl': None, 'short_series_handling': True, 'enable_early_stopping': True, 'early_stopping_n_iters': 10, 'metrics': None, 'enable_ensembling': True, 'enable_stack_ensembling': False, 'ensemble_iterations': 15, 'enable_tf': False, 'enable_subsampling': False, 'subsample_seed': None, 'enable_nimbusml': False, 'enable_streaming': False, 'force_streaming': False, 'track_child_runs': True, 'label_column_name': 'cnt', 'weight_column_name': None, 'cv_split_column_names': None, 'enable_local_managed': False, 'cost_mode': 1, 'lag_length': 0, 'metric_operation': 'minimize', 'preprocess': True, 'scenario': 'SDK-Compatible'}\",\n 'AMLSettingsJsonString': '{\"path\":\"/home/codespace/workspace/c9-dev-intro-data-science/regression-with-bikes\",\"name\":\"MyWorkSp-exp\",\"subscription_id\":\"3de1cda7-0778-4934-83d4-d423f8ccde1d\",\"resource_group\":\"MyWorkSp-rg\",\"workspace_name\":\"MyWorkSp\",\"region\":\"japaneast\",\"compute_target\":\"MyCluster\",\"spark_service\":null,\"azure_service\":\"remote\",\"_local_managed_run_id\":null,\"iterations\":1000,\"primary_metric\":\"normalized_root_mean_squared_error\",\"task_type\":\"regression\",\"data_script\":null,\"validation_size\":0.0,\"n_cross_validations\":3,\"y_min\":null,\"y_max\":null,\"num_classes\":null,\"featurization\":\"auto\",\"_ignore_package_version_incompatibilities\":false,\"is_timeseries\":true,\"max_cores_per_iteration\":-1,\"max_concurrent_iterations\":4,\"iteration_timeout_minutes\":null,\"mem_in_mb\":null,\"enforce_time_on_windows\":false,\"experiment_timeout_minutes\":30,\"experiment_exit_score\":null,\"whitelist_models\":null,\"blacklist_algos\":[\"ExtremeRandomTrees\",\"AutoArima\",\"Prophet\"],\"supported_models\":[\"ElasticNet\",\"ExtremeRandomTrees\",\"DecisionTree\",\"AutoArima\",\"SGD\",\"XGBoostRegressor\",\"LassoLars\",\"RandomForest\",\"KNN\",\"LightGBM\",\"TensorFlowDNN\",\"Prophet\",\"TCNForecaster\",\"GradientBoosting\",\"TensorFlowLinearRegressor\"],\"auto_blacklist\":true,\"blacklist_samples_reached\":false,\"exclude_nan_labels\":true,\"verbosity\":20,\"_debug_log\":\"azureml_automl.log\",\"show_warnings\":false,\"model_explainability\":true,\"service_url\":null,\"sdk_url\":null,\"sdk_packages\":null,\"enable_onnx_compatible_models\":false,\"enable_split_onnx_featurizer_estimator_models\":false,\"vm_type\":\"STANDARD_D1_V2\",\"telemetry_verbosity\":20,\"send_telemetry\":true,\"enable_dnn\":false,\"force_text_dnn\":false,\"enable_feature_sweeping\":false,\"time_column_name\":\"date\",\"grain_column_names\":null,\"drop_column_names\":[\"casual\",\"registered\"],\"max_horizon\":14,\"dropna\":false,\"overwrite_columns\":true,\"transform_dictionary\":{\"min\":\"_automl_target_col\",\"max\":\"_automl_target_col\",\"mean\":\"_automl_target_col\"},\"window_size\":null,\"country_or_region\":\"JP\",\"lags\":{\"_automl_target_col\":[\"auto\"]},\"feature_lags\":null,\"seasonality\":-1,\"use_stl\":null,\"short_series_handling\":true,\"enable_early_stopping\":true,\"early_stopping_n_iters\":10,\"metrics\":null,\"enable_ensembling\":true,\"enable_stack_ensembling\":false,\"ensemble_iterations\":15,\"enable_tf\":false,\"enable_subsampling\":false,\"subsample_seed\":null,\"enable_nimbusml\":false,\"enable_streaming\":false,\"force_streaming\":false,\"track_child_runs\":true,\"label_column_name\":\"cnt\",\"weight_column_name\":null,\"cv_split_column_names\":null,\"enable_local_managed\":false,\"cost_mode\":1,\"lag_length\":0,\"metric_operation\":\"minimize\",\"preprocess\":true,\"scenario\":\"SDK-Compatible\"}',\n 'DataPrepJsonString': '{\\\\\"training_data\\\\\": \\\\\"{\\\\\\\\\\\\\"blocks\\\\\\\\\\\\\": [{\\\\\\\\\\\\\"id\\\\\\\\\\\\\": \\\\\\\\\\\\\"b1f093de-b3cd-458d-ba74-784b6a02f540\\\\\\\\\\\\\", \\\\\\\\\\\\\"type\\\\\\\\\\\\\": \\\\\\\\\\\\\"Microsoft.DPrep.GetDatastoreFilesBlock\\\\\\\\\\\\\", \\\\\\\\\\\\\"arguments\\\\\\\\\\\\\": {\\\\\\\\\\\\\"datastores\\\\\\\\\\\\\": [{\\\\\\\\\\\\\"datastoreName\\\\\\\\\\\\\": \\\\\\\\\\\\\"workspaceblobstore\\\\\\\\\\\\\", \\\\\\\\\\\\\"path\\\\\\\\\\\\\": \\\\\\\\\\\\\"files/2020-07-12_14:42:53.959_UTC\\\\\\\\\\\\\", \\\\\\\\\\\\\"resourceGroup\\\\\\\\\\\\\": \\\\\\\\\\\\\"MyWorkSp-rg\\\\\\\\\\\\\", \\\\\\\\\\\\\"subscription\\\\\\\\\\\\\": \\\\\\\\\\\\\"3de1cda7-0778-4934-83d4-d423f8ccde1d\\\\\\\\\\\\\", \\\\\\\\\\\\\"workspaceName\\\\\\\\\\\\\": \\\\\\\\\\\\\"MyWorkSp\\\\\\\\\\\\\"}]}, \\\\\\\\\\\\\"localData\\\\\\\\\\\\\": {}, \\\\\\\\\\\\\"isEnabled\\\\\\\\\\\\\": true, \\\\\\\\\\\\\"name\\\\\\\\\\\\\": null, \\\\\\\\\\\\\"annotation\\\\\\\\\\\\\": null}, {\\\\\\\\\\\\\"id\\\\\\\\\\\\\": \\\\\\\\\\\\\"b4dc49c4-67cc-40ae-9faf-26c93d9db469\\\\\\\\\\\\\", \\\\\\\\\\\\\"type\\\\\\\\\\\\\": \\\\\\\\\\\\\"Microsoft.DPrep.ParseDelimitedBlock\\\\\\\\\\\\\", \\\\\\\\\\\\\"arguments\\\\\\\\\\\\\": {\\\\\\\\\\\\\"columnHeadersMode\\\\\\\\\\\\\": 3, \\\\\\\\\\\\\"fileEncoding\\\\\\\\\\\\\": 0, \\\\\\\\\\\\\"handleQuotedLineBreaks\\\\\\\\\\\\\": false, \\\\\\\\\\\\\"preview\\\\\\\\\\\\\": false, \\\\\\\\\\\\\"separator\\\\\\\\\\\\\": \\\\\\\\\\\\\",\\\\\\\\\\\\\", \\\\\\\\\\\\\"skipRows\\\\\\\\\\\\\": 0, \\\\\\\\\\\\\"skipRowsMode\\\\\\\\\\\\\": 0}, \\\\\\\\\\\\\"localData\\\\\\\\\\\\\": {}, \\\\\\\\\\\\\"isEnabled\\\\\\\\\\\\\": true, \\\\\\\\\\\\\"name\\\\\\\\\\\\\": null, \\\\\\\\\\\\\"annotation\\\\\\\\\\\\\": null}, {\\\\\\\\\\\\\"id\\\\\\\\\\\\\": \\\\\\\\\\\\\"bc490de2-c294-4cc6-90aa-cbacc4d2b478\\\\\\\\\\\\\", \\\\\\\\\\\\\"type\\\\\\\\\\\\\": \\\\\\\\\\\\\"Microsoft.DPrep.DropColumnsBlock\\\\\\\\\\\\\", \\\\\\\\\\\\\"arguments\\\\\\\\\\\\\": {\\\\\\\\\\\\\"columns\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 0, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumns\\\\\\\\\\\\\": [\\\\\\\\\\\\\"Path\\\\\\\\\\\\\"]}}}, \\\\\\\\\\\\\"localData\\\\\\\\\\\\\": {}, \\\\\\\\\\\\\"isEnabled\\\\\\\\\\\\\": true, \\\\\\\\\\\\\"name\\\\\\\\\\\\\": null, \\\\\\\\\\\\\"annotation\\\\\\\\\\\\\": null}, {\\\\\\\\\\\\\"id\\\\\\\\\\\\\": \\\\\\\\\\\\\"4b0edadb-5a12-44f1-b283-98c6e77cdc4e\\\\\\\\\\\\\", \\\\\\\\\\\\\"type\\\\\\\\\\\\\": \\\\\\\\\\\\\"Microsoft.DPrep.SetColumnTypesBlock\\\\\\\\\\\\\", \\\\\\\\\\\\\"arguments\\\\\\\\\\\\\": {\\\\\\\\\\\\\"columnConversion\\\\\\\\\\\\\": [{\\\\\\\\\\\\\"column\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 2, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumn\\\\\\\\\\\\\": \\\\\\\\\\\\\"Path\\\\\\\\\\\\\"}}, \\\\\\\\\\\\\"typeProperty\\\\\\\\\\\\\": 0}, {\\\\\\\\\\\\\"column\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 2, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumn\\\\\\\\\\\\\": \\\\\\\\\\\\\"instant\\\\\\\\\\\\\"}}, \\\\\\\\\\\\\"typeProperty\\\\\\\\\\\\\": 2}, {\\\\\\\\\\\\\"column\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 2, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumn\\\\\\\\\\\\\": \\\\\\\\\\\\\"date\\\\\\\\\\\\\"}}, \\\\\\\\\\\\\"typeArguments\\\\\\\\\\\\\": {\\\\\\\\\\\\\"dateTimeFormats\\\\\\\\\\\\\": [\\\\\\\\\\\\\"%m/%d/%Y\\\\\\\\\\\\\"]}, \\\\\\\\\\\\\"typeProperty\\\\\\\\\\\\\": 4}, {\\\\\\\\\\\\\"column\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 2, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumn\\\\\\\\\\\\\": \\\\\\\\\\\\\"season\\\\\\\\\\\\\"}}, \\\\\\\\\\\\\"typeProperty\\\\\\\\\\\\\": 2}, {\\\\\\\\\\\\\"column\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 2, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumn\\\\\\\\\\\\\": \\\\\\\\\\\\\"yr\\\\\\\\\\\\\"}}, \\\\\\\\\\\\\"typeProperty\\\\\\\\\\\\\": 2}, {\\\\\\\\\\\\\"column\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 2, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumn\\\\\\\\\\\\\": \\\\\\\\\\\\\"mnth\\\\\\\\\\\\\"}}, \\\\\\\\\\\\\"typeProperty\\\\\\\\\\\\\": 2}, {\\\\\\\\\\\\\"column\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 2, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumn\\\\\\\\\\\\\": \\\\\\\\\\\\\"weekday\\\\\\\\\\\\\"}}, \\\\\\\\\\\\\"typeProperty\\\\\\\\\\\\\": 2}, {\\\\\\\\\\\\\"column\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 2, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumn\\\\\\\\\\\\\": \\\\\\\\\\\\\"weathersit\\\\\\\\\\\\\"}}, \\\\\\\\\\\\\"typeProperty\\\\\\\\\\\\\": 2}, {\\\\\\\\\\\\\"column\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 2, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumn\\\\\\\\\\\\\": \\\\\\\\\\\\\"temp\\\\\\\\\\\\\"}}, \\\\\\\\\\\\\"typeProperty\\\\\\\\\\\\\": 3}, {\\\\\\\\\\\\\"column\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 2, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumn\\\\\\\\\\\\\": \\\\\\\\\\\\\"atemp\\\\\\\\\\\\\"}}, \\\\\\\\\\\\\"typeProperty\\\\\\\\\\\\\": 3}, {\\\\\\\\\\\\\"column\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 2, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumn\\\\\\\\\\\\\": \\\\\\\\\\\\\"hum\\\\\\\\\\\\\"}}, \\\\\\\\\\\\\"typeProperty\\\\\\\\\\\\\": 3}, {\\\\\\\\\\\\\"column\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 2, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumn\\\\\\\\\\\\\": \\\\\\\\\\\\\"windspeed\\\\\\\\\\\\\"}}, \\\\\\\\\\\\\"typeProperty\\\\\\\\\\\\\": 3}, {\\\\\\\\\\\\\"column\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 2, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumn\\\\\\\\\\\\\": \\\\\\\\\\\\\"casual\\\\\\\\\\\\\"}}, \\\\\\\\\\\\\"typeProperty\\\\\\\\\\\\\": 2}, {\\\\\\\\\\\\\"column\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 2, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumn\\\\\\\\\\\\\": \\\\\\\\\\\\\"registered\\\\\\\\\\\\\"}}, \\\\\\\\\\\\\"typeProperty\\\\\\\\\\\\\": 2}, {\\\\\\\\\\\\\"column\\\\\\\\\\\\\": {\\\\\\\\\\\\\"type\\\\\\\\\\\\\": 2, \\\\\\\\\\\\\"details\\\\\\\\\\\\\": {\\\\\\\\\\\\\"selectedColumn\\\\\\\\\\\\\": \\\\\\\\\\\\\"cnt\\\\\\\\\\\\\"}}, \\\\\\\\\\\\\"typeProperty\\\\\\\\\\\\\": 2}]}, \\\\\\\\\\\\\"localData\\\\\\\\\\\\\": {}, \\\\\\\\\\\\\"isEnabled\\\\\\\\\\\\\": true, \\\\\\\\\\\\\"name\\\\\\\\\\\\\": null, \\\\\\\\\\\\\"annotation\\\\\\\\\\\\\": null}, {\\\\\\\\\\\\\"id\\\\\\\\\\\\\": \\\\\\\\\\\\\"2483a6ae-c4a4-466e-8137-6742d4162204\\\\\\\\\\\\\", \\\\\\\\\\\\\"type\\\\\\\\\\\\\": \\\\\\\\\\\\\"Microsoft.DPrep.ExpressionFilterBlock\\\\\\\\\\\\\", \\\\\\\\\\\\\"arguments\\\\\\\\\\\\\": {\\\\\\\\\\\\\"expression\\\\\\\\\\\\\": {\\\\\\\\\\\\\"r\\\\\\\\\\\\\": [\\\\\\\\\\\\\"And\\\\\\\\\\\\\", [true, {\\\\\\\\\\\\\"r\\\\\\\\\\\\\": [\\\\\\\\\\\\\"Invoke\\\\\\\\\\\\\", [{\\\\\\\\\\\\\"r\\\\\\\\\\\\\": [\\\\\\\\\\\\\"Identifier\\\\\\\\\\\\\", \\\\\\\\\\\\\"Value_LE\\\\\\\\\\\\\"]}, [{\\\\\\\\\\\\\"r\\\\\\\\\\\\\": [\\\\\\\\\\\\\"RecordField\\\\\\\\\\\\\", [{\\\\\\\\\\\\\"r\\\\\\\\\\\\\": [\\\\\\\\\\\\\"Identifier\\\\\\\\\\\\\", \\\\\\\\\\\\\"row\\\\\\\\\\\\\"]}, \\\\\\\\\\\\\"date\\\\\\\\\\\\\"]]}, {\\\\\\\\\\\\\"d\\\\\\\\\\\\\": 634819680000000000}]]]}]]}}, \\\\\\\\\\\\\"localData\\\\\\\\\\\\\": {}, \\\\\\\\\\\\\"isEnabled\\\\\\\\\\\\\": true, \\\\\\\\\\\\\"name\\\\\\\\\\\\\": null, \\\\\\\\\\\\\"annotation\\\\\\\\\\\\\": null}], \\\\\\\\\\\\\"inspectors\\\\\\\\\\\\\": [], \\\\\\\\\\\\\"meta\\\\\\\\\\\\\": {\\\\\\\\\\\\\"savedDatasetId\\\\\\\\\\\\\": \\\\\\\\\\\\\"814631dc-eb7f-49ed-9dbf-44db65b6ba0c\\\\\\\\\\\\\", \\\\\\\\\\\\\"datasetType\\\\\\\\\\\\\": \\\\\\\\\\\\\"tabular\\\\\\\\\\\\\", \\\\\\\\\\\\\"subscriptionId\\\\\\\\\\\\\": \\\\\\\\\\\\\"3de1cda7-0778-4934-83d4-d423f8ccde1d\\\\\\\\\\\\\", \\\\\\\\\\\\\"workspaceId\\\\\\\\\\\\\": \\\\\\\\\\\\\"cb19dfc1-7aea-41dd-940a-6ff57e8ad927\\\\\\\\\\\\\", \\\\\\\\\\\\\"workspaceLocation\\\\\\\\\\\\\": \\\\\\\\\\\\\"japaneast\\\\\\\\\\\\\", \\\\\\\\\\\\\"TimeSeries_Column:FineGrainTimestamp_\\\\\\\\\\\\\": \\\\\\\\\\\\\"true\\\\\\\\\\\\\"}}\\\\\", \\\\\"activities\\\\\": 0}',\n 'EnableSubsampling': 'False',\n 'runTemplate': 'AutoML',\n 'azureml.runsource': 'automl',\n 'display_task_type': 'forecasting',\n 'dependencies_versions': '{\"azureml-train\": \"1.9.0\", \"azureml-train-restclients-hyperdrive\": \"1.9.0\", \"azureml-train-core\": \"1.9.0\", \"azureml-train-automl\": \"1.9.0\", \"azureml-train-automl-runtime\": \"1.9.0\", \"azureml-train-automl-client\": \"1.9.0\", \"azureml-telemetry\": \"1.9.0\", \"azureml-sdk\": \"1.9.0\", \"azureml-pipeline\": \"1.9.0\", \"azureml-pipeline-steps\": \"1.9.0\", \"azureml-pipeline-core\": \"1.9.0\", \"azureml-model-management-sdk\": \"1.0.1b6.post1\", \"azureml-interpret\": \"1.9.0\", \"azureml-explain-model\": \"1.9.0\", \"azureml-defaults\": \"1.9.0\", \"azureml-dataprep\": \"1.9.1\", \"azureml-dataprep-native\": \"14.2.1\", \"azureml-core\": \"1.9.0\", \"azureml-automl-runtime\": \"1.9.0\", \"azureml-automl-core\": \"1.9.0\"}',\n 'ClientSdkVersion': '1.9.0',\n 'ClientType': 'SDK',\n 'environment_cpu_name': 'AzureML-AutoML',\n 'environment_cpu_version': '25',\n 'environment_gpu_name': 'AzureML-AutoML-GPU',\n 'environment_gpu_version': '14',\n 'root_attribution': 'automl',\n 'attribution': 'AutoML',\n 'CancelUri': 'https://japaneast.experiments.azureml.net/jasmine/v1.0/subscriptions/3de1cda7-0778-4934-83d4-d423f8ccde1d/resourceGroups/MyWorkSp-rg/providers/Microsoft.MachineLearningServices/workspaces/MyWorkSp/experiment/MyWorkSp-exp/cancel/AutoML_b963fb5c-8ab2-4914-9ef3-98951049e463',\n 'Orchestrator': 'AutoML',\n 'ContentSnapshotId': '7c33d8a5-795f-479c-a8b7-590e92a2b19b',\n 'azureml.git.repository_uri': 'https://github.com/microsoft/c9-dev-intro-data-science',\n 'mlflow.source.git.repoURL': 'https://github.com/microsoft/c9-dev-intro-data-science',\n 'azureml.git.branch': 'main',\n 'mlflow.source.git.branch': 'main',\n 'azureml.git.commit': 'b478972adddc8a12d4b7ab9e46a1886c3acfefca',\n 'mlflow.source.git.commit': 'b478972adddc8a12d4b7ab9e46a1886c3acfefca',\n 'azureml.git.dirty': 'True',\n 'SetupRunId': 'AutoML_b963fb5c-8ab2-4914-9ef3-98951049e463_setup',\n 'SetupRunContainerId': 'dcid.AutoML_b963fb5c-8ab2-4914-9ef3-98951049e463_setup',\n 'forecasting_target_lags': '[1]',\n 'forecasting_target_rolling_window_size': '0',\n 'forecasting_max_horizon': '14',\n 'ProblemInfoJsonString': '{\"dataset_num_categorical\": 0, \"is_sparse\": false, \"subsampling\": false, \"dataset_classes\": 586, \"dataset_features\": 102, \"dataset_samples\": 8421, \"single_frequency_class_detected\": false}',\n 'ModelExplainRunId': 'AutoML_b963fb5c-8ab2-4914-9ef3-98951049e463_ModelExplain'},\n 'inputDatasets': [{'dataset': {'id': '814631dc-eb7f-49ed-9dbf-44db65b6ba0c'}, 'consumptionDetails': {'type': 'RunInput', 'inputName': 'training_data', 'mechanism': 'Direct'}}],\n 'logFiles': {}}"
},
"metadata": {},
"execution_count": 13
}
],
"source": [
"remote_run.wait_for_completion()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"tags": []
},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": "WARNING - Using different time series parameters in AutoML configs for forecasting tasks will be deprecated, please use ForecastingParameters class instead.\nWARNING - Forecasting parameter max_horizon will be deprecated in the future, please use forecast_horizon instead.\nWARNING - Forecasting parameter country_or_region will be deprecated in the future, please use holiday_country instead.\nWARNING - Forecasting parameter grain_column_names will be deprecated in the future, please use time_series_id_column_names instead.\nWARNING - Using different time series parameters in AutoML configs for forecasting tasks will be deprecated, please use ForecastingParameters class instead.\nWARNING - Forecasting parameter max_horizon will be deprecated in the future, please use forecast_horizon instead.\nWARNING - Forecasting parameter country_or_region will be deprecated in the future, please use holiday_country instead.\nWARNING - Forecasting parameter grain_column_names will be deprecated in the future, please use time_series_id_column_names instead.\n"
},
{
"output_type": "execute_result",
"data": {
"text/plain": "Run(Experiment: MyWorkSp-exp,\nId: AutoML_b963fb5c-8ab2-4914-9ef3-98951049e463_33,\nType: azureml.scriptrun,\nStatus: Completed)",
"text/html": "<table style=\"width:100%\"><tr><th>Experiment</th><th>Id</th><th>Type</th><th>Status</th><th>Details Page</th><th>Docs Page</th></tr><tr><td>MyWorkSp-exp</td><td>AutoML_b963fb5c-8ab2-4914-9ef3-98951049e463_33</td><td>azureml.scriptrun</td><td>Completed</td><td><a href=\"https://ml.azure.com/experiments/MyWorkSp-exp/runs/AutoML_b963fb5c-8ab2-4914-9ef3-98951049e463_33?wsid=/subscriptions/3de1cda7-0778-4934-83d4-d423f8ccde1d/resourcegroups/MyWorkSp-rg/workspaces/MyWorkSp\" target=\"_blank\" rel=\"noopener\">Link to Azure Machine Learning studio</a></td><td><a href=\"https://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.run.Run?view=azure-ml-py\" target=\"_blank\" rel=\"noopener\">Link to Documentation</a></td></tr></table>"
},
"metadata": {},
"execution_count": 14
}
],
"source": [
"best_run, fitted_model = remote_run.get_output()\n",
"best_run"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"model_name = best_run.properties['model_name']\n",
"model_name"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": 3
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python_defaultSpec_1594565999022",
"display_name": "Python 3.7.7 64-bit ('my-azuremltest': conda)"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment