Skip to content

Commit

Permalink
update samples from Release-55 as a part of SDK release
Browse files Browse the repository at this point in the history
  • Loading branch information
amlrelsa-ms committed Jun 8, 2020
1 parent 3489882 commit 34a67c1
Show file tree
Hide file tree
Showing 40 changed files with 1,372 additions and 129 deletions.
2 changes: 1 addition & 1 deletion configuration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"source": [
"import azureml.core\n",
"\n",
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
Expand Down Expand Up @@ -491,8 +491,8 @@
"metadata": {},
"outputs": [],
"source": [
"test_run = run_inference(test_experiment, compute_target, script_folder, best_dnn_run, test_dataset,\n",
" target_column_name, model_name)"
"test_run = run_inference(test_experiment, compute_target, script_folder, best_dnn_run,\n",
" train_dataset, test_dataset, target_column_name, model_name)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def run_inference(test_experiment, compute_target, script_folder, train_run,
test_dataset, target_column_name, model_name):
train_dataset, test_dataset, target_column_name, model_name):

train_run.download_file('outputs/conda_env_v_1_0_0.yml',
'inference/condafile.yml')
Expand All @@ -22,7 +22,10 @@ def run_inference(test_experiment, compute_target, script_folder, train_run,
'--target_column_name': target_column_name,
'--model_name': model_name
},
inputs=[test_dataset.as_named_input('test_data')],
inputs=[
train_dataset.as_named_input('train_data'),
test_dataset.as_named_input('test_data')
],
compute_target=compute_target,
environment_definition=inference_env)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import numpy as np
import argparse
from azureml.core import Run

import numpy as np

from sklearn.externals import joblib
from azureml.automl.core.shared import constants, metrics

from azureml.automl.runtime.shared.score import scoring, constants
from azureml.core import Run
from azureml.core.model import Model


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

X_test_df = test_dataset.drop_columns(columns=[target_column_name]) \
.to_pandas_dataframe()
y_test_df = test_dataset.with_timestamp_columns(None) \
.keep_columns(columns=[target_column_name]) \
.to_pandas_dataframe()
y_train_df = test_dataset.with_timestamp_columns(None) \
.keep_columns(columns=[target_column_name]) \
.to_pandas_dataframe()

predicted = model.predict_proba(X_test_df)

# use automl metrics module
scores = metrics.compute_metrics_classification(
np.array(predicted),
np.array(y_test_df),
class_labels=model.classes_,
metrics=list(constants.Metric.SCALAR_CLASSIFICATION_SET)
)
# Use the AutoML scoring module
class_labels = np.unique(np.concatenate((y_train_df.values, y_test_df.values)))
train_labels = model.classes_
classification_metrics = list(constants.CLASSIFICATION_SCALAR_SET)
scores = scoring.score_classification(y_test_df.values, predicted,
classification_metrics,
class_labels, train_labels)

print("scores:")
print(scores)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import pandas as pd
import numpy as np
import argparse
from azureml.core import Run

import numpy as np
import pandas as pd

from pandas.tseries.frequencies import to_offset
from sklearn.externals import joblib
from sklearn.metrics import mean_absolute_error, mean_squared_error
from azureml.automl.core.shared import constants, metrics
from pandas.tseries.frequencies import to_offset

from azureml.automl.runtime.shared.score import scoring, constants
from azureml.core import Run


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

# use automl metrics module
scores = metrics.compute_metrics_regression(
df_all['predicted'],
df_all[target_column_name],
list(constants.Metric.SCALAR_REGRESSION_SET),
None, None, None)
# Use the AutoML scoring module
regression_metrics = list(constants.REGRESSION_SCALAR_SET)
y_test = np.array(df_all[target_column_name])
y_pred = np.array(df_all['predicted'])
scores = scoring.score_regression(y_test, y_pred, regression_metrics)

print("scores:")
print(scores)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"This notebook was created using version 1.6.0 of the Azure ML SDK\")\n",
"print(\"This notebook was created using version 1.7.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
Expand Down Expand Up @@ -336,7 +336,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"sample-featurizationconfig-remarks"
]
},
"outputs": [],
"source": [
"featurization_config = FeaturizationConfig()\n",
Expand Down
Loading

0 comments on commit 34a67c1

Please sign in to comment.