Skip to content

Commit 738347f

Browse files
authored
Merge pull request Azure#996 from Azure/release_update/Release-55
update samples from Release-55 as a part of SDK release
2 parents 3489882 + 34a67c1 commit 738347f

File tree

40 files changed

+1372
-129
lines changed

40 files changed

+1372
-129
lines changed

configuration.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"source": [
104104
"import azureml.core\n",
105105
"\n",
106-
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
106+
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
107107
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
108108
]
109109
},

how-to-use-azureml/automated-machine-learning/classification-bank-marketing-all-features/auto-ml-classification-bank-marketing-all-features.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"metadata": {},
106106
"outputs": [],
107107
"source": [
108-
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
108+
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
109109
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
110110
]
111111
},

how-to-use-azureml/automated-machine-learning/classification-credit-card-fraud/auto-ml-classification-credit-card-fraud.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"metadata": {},
9494
"outputs": [],
9595
"source": [
96-
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
96+
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
9797
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
9898
]
9999
},

how-to-use-azureml/automated-machine-learning/classification-text-dnn/auto-ml-classification-text-dnn.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"metadata": {},
9898
"outputs": [],
9999
"source": [
100-
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
100+
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
101101
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
102102
]
103103
},
@@ -491,8 +491,8 @@
491491
"metadata": {},
492492
"outputs": [],
493493
"source": [
494-
"test_run = run_inference(test_experiment, compute_target, script_folder, best_dnn_run, test_dataset,\n",
495-
" target_column_name, model_name)"
494+
"test_run = run_inference(test_experiment, compute_target, script_folder, best_dnn_run,\n",
495+
" train_dataset, test_dataset, target_column_name, model_name)"
496496
]
497497
},
498498
{

how-to-use-azureml/automated-machine-learning/classification-text-dnn/helper.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def run_inference(test_experiment, compute_target, script_folder, train_run,
9-
test_dataset, target_column_name, model_name):
9+
train_dataset, test_dataset, target_column_name, model_name):
1010

1111
train_run.download_file('outputs/conda_env_v_1_0_0.yml',
1212
'inference/condafile.yml')
@@ -22,7 +22,10 @@ def run_inference(test_experiment, compute_target, script_folder, train_run,
2222
'--target_column_name': target_column_name,
2323
'--model_name': model_name
2424
},
25-
inputs=[test_dataset.as_named_input('test_data')],
25+
inputs=[
26+
train_dataset.as_named_input('train_data'),
27+
test_dataset.as_named_input('test_data')
28+
],
2629
compute_target=compute_target,
2730
environment_definition=inference_env)
2831

how-to-use-azureml/automated-machine-learning/classification-text-dnn/infer.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
import numpy as np
21
import argparse
3-
from azureml.core import Run
2+
3+
import numpy as np
4+
45
from sklearn.externals import joblib
5-
from azureml.automl.core.shared import constants, metrics
6+
7+
from azureml.automl.runtime.shared.score import scoring, constants
8+
from azureml.core import Run
69
from azureml.core.model import Model
710

811

@@ -29,22 +32,26 @@
2932
run = Run.get_context()
3033
# get input dataset by name
3134
test_dataset = run.input_datasets['test_data']
35+
train_dataset = run.input_datasets['train_data']
3236

3337
X_test_df = test_dataset.drop_columns(columns=[target_column_name]) \
3438
.to_pandas_dataframe()
3539
y_test_df = test_dataset.with_timestamp_columns(None) \
3640
.keep_columns(columns=[target_column_name]) \
3741
.to_pandas_dataframe()
42+
y_train_df = test_dataset.with_timestamp_columns(None) \
43+
.keep_columns(columns=[target_column_name]) \
44+
.to_pandas_dataframe()
3845

3946
predicted = model.predict_proba(X_test_df)
4047

41-
# use automl metrics module
42-
scores = metrics.compute_metrics_classification(
43-
np.array(predicted),
44-
np.array(y_test_df),
45-
class_labels=model.classes_,
46-
metrics=list(constants.Metric.SCALAR_CLASSIFICATION_SET)
47-
)
48+
# Use the AutoML scoring module
49+
class_labels = np.unique(np.concatenate((y_train_df.values, y_test_df.values)))
50+
train_labels = model.classes_
51+
classification_metrics = list(constants.CLASSIFICATION_SCALAR_SET)
52+
scores = scoring.score_classification(y_test_df.values, predicted,
53+
classification_metrics,
54+
class_labels, train_labels)
4855

4956
print("scores:")
5057
print(scores)

how-to-use-azureml/automated-machine-learning/continuous-retraining/auto-ml-continuous-retraining.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"metadata": {},
8989
"outputs": [],
9090
"source": [
91-
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
91+
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
9292
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
9393
]
9494
},

how-to-use-azureml/automated-machine-learning/forecasting-beer-remote/auto-ml-forecasting-beer-remote.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"metadata": {},
115115
"outputs": [],
116116
"source": [
117-
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
117+
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
118118
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
119119
]
120120
},

how-to-use-azureml/automated-machine-learning/forecasting-beer-remote/infer.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
import pandas as pd
2-
import numpy as np
31
import argparse
4-
from azureml.core import Run
2+
3+
import numpy as np
4+
import pandas as pd
5+
6+
from pandas.tseries.frequencies import to_offset
57
from sklearn.externals import joblib
68
from sklearn.metrics import mean_absolute_error, mean_squared_error
7-
from azureml.automl.core.shared import constants, metrics
8-
from pandas.tseries.frequencies import to_offset
9+
10+
from azureml.automl.runtime.shared.score import scoring, constants
11+
from azureml.core import Run
912

1013

1114
def align_outputs(y_predicted, X_trans, X_test, y_test,
@@ -299,12 +302,11 @@ def MAPE(actual, pred):
299302
print("predicted values:::")
300303
print(df_all['predicted'])
301304

302-
# use automl metrics module
303-
scores = metrics.compute_metrics_regression(
304-
df_all['predicted'],
305-
df_all[target_column_name],
306-
list(constants.Metric.SCALAR_REGRESSION_SET),
307-
None, None, None)
305+
# Use the AutoML scoring module
306+
regression_metrics = list(constants.REGRESSION_SCALAR_SET)
307+
y_test = np.array(df_all[target_column_name])
308+
y_pred = np.array(df_all['predicted'])
309+
scores = scoring.score_regression(y_test, y_pred, regression_metrics)
308310

309311
print("scores:")
310312
print(scores)

how-to-use-azureml/automated-machine-learning/forecasting-bike-share/auto-ml-forecasting-bike-share.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"metadata": {},
8888
"outputs": [],
8989
"source": [
90-
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
90+
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
9191
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
9292
]
9393
},

0 commit comments

Comments
 (0)