Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated automl regression notebook to work with the latest matplotlib #1901

Merged
merged 8 commits into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ jobs:
working-directory: v1/python-sdk/tutorials/automl-with-azureml/classification-bank-marketing-all-features
- name: check notebook output
run: |
python scripts/validation/check_notebook_output.py \
python v1/scripts/validation/check_notebook_output.py \
--file_name auto-ml-classification-bank-marketing-all-features.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/classification-bank-marketing-all-features \
--check warning
- name: check experiment result
run: |
python scripts/validation/check_experiment_result.py \
python v1/scripts/validation/check_experiment_result.py \
--file_name auto-ml-classification-bank-marketing-all-features.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/classification-bank-marketing-all-features \
--experiment_name automl-classification-bmarketing-all \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ jobs:
working-directory: v1/python-sdk/tutorials/automl-with-azureml/local-run-classification-credit-card-fraud
- name: check notebook output
run: |
python scripts/validation/check_notebook_output.py \
python v1/scripts/validation/check_notebook_output.py \
--file_name auto-ml-classification-credit-card-fraud-local.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/local-run-classification-credit-card-fraud \
--check warning stderr
- name: check experiment result
run: |
python scripts/validation/check_experiment_result.py \
python v1/scripts/validation/check_experiment_result.py \
--file_name auto-ml-classification-credit-card-fraud-local.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/local-run-classification-credit-card-fraud \
--experiment_name automl-classification-ccard-local \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ jobs:
working-directory: v1/python-sdk/tutorials/automl-with-azureml/classification-credit-card-fraud
- name: check notebook output
run: |
python scripts/validation/check_notebook_output.py \
python v1/scripts/validation/check_notebook_output.py \
--file_name auto-ml-classification-credit-card-fraud.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/classification-credit-card-fraud \
--check warning stderr
- name: check experiment result
run: |
python scripts/validation/check_experiment_result.py \
python v1/scripts/validation/check_experiment_result.py \
--file_name auto-ml-classification-credit-card-fraud.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/classification-credit-card-fraud \
--experiment_name automl-classification-ccard-remote \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ jobs:
working-directory: v1/python-sdk/tutorials/automl-with-azureml/classification-text-dnn
- name: check notebook output
run: |
python scripts/validation/check_notebook_output.py \
python v1/scripts/validation/check_notebook_output.py \
--file_name auto-ml-classification-text-dnn.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/classification-text-dnn \
--check warning stderr
- name: check experiment result
run: |
python scripts/validation/check_experiment_result.py \
python v1/scripts/validation/check_experiment_result.py \
--file_name auto-ml-classification-text-dnn.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/classification-text-dnn \
--experiment_name automl-classification-text-dnn \
--minimum_median_score 0.3 \
--metric_name accuracy
- name: check cell output
run: |
python scripts/validation/check_cell_output.py \
python v1/scripts/validation/check_cell_output.py \
--file_name auto-ml-classification-text-dnn.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/classification-text-dnn \
--cell_source \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
working-directory: v1/python-sdk/tutorials/automl-with-azureml/continuous-retraining
- name: check notebook output
run: |
python scripts/validation/check_notebook_output.py \
python v1/scripts/validation/check_notebook_output.py \
--file_name auto-ml-continuous-retraining.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/continuous-retraining \
--check warning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ jobs:
working-directory: v1/python-sdk/tutorials/automl-with-azureml/forecasting-bike-share
- name: check notebook output
run: |
python scripts/validation/check_notebook_output.py \
python v1/scripts/validation/check_notebook_output.py \
--file_name auto-ml-forecasting-bike-share.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/forecasting-bike-share \
--check warning
- name: check experiment result
run: |
python scripts/validation/check_experiment_result.py \
python v1/scripts/validation/check_experiment_result.py \
--file_name auto-ml-forecasting-bike-share.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/forecasting-bike-share \
--experiment_name automl-bikeshareforecasting \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ jobs:
working-directory: v1/python-sdk/tutorials/automl-with-azureml/forecasting-energy-demand
- name: check notebook output
run: |
python scripts/validation/check_notebook_output.py \
python v1/scripts/validation/check_notebook_output.py \
--file_name auto-ml-forecasting-energy-demand.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/forecasting-energy-demand \
--check warning stderr
- name: check experiment result
run: |
python scripts/validation/check_experiment_result.py \
python v1/scripts/validation/check_experiment_result.py \
--file_name auto-ml-forecasting-energy-demand.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/forecasting-energy-demand \
--experiment_name automl-forecasting-energydemand \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ jobs:
working-directory: v1/python-sdk/tutorials/automl-with-azureml/forecasting-forecast-function
- name: check notebook output
run: |
python scripts/validation/check_notebook_output.py \
python v1/scripts/validation/check_notebook_output.py \
--file_name auto-ml-forecasting-function.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/forecasting-forecast-function \
--check warning stderr
- name: check experiment result
run: |
python scripts/validation/check_experiment_result.py \
python v1/scripts/validation/check_experiment_result.py \
--file_name auto-ml-forecasting-function.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/forecasting-forecast-function \
--experiment_name automl-forecast-function-demo \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ jobs:
working-directory: v1/python-sdk/tutorials/automl-with-azureml/forecasting-hierarchical-timeseries
- name: check notebook output
run: |
python scripts/validation/check_notebook_output.py \
python v1/scripts/validation/check_notebook_output.py \
--file_name auto-ml-forecasting-hierarchical-timeseries.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/forecasting-hierarchical-timeseries \
--check warning
- name: check timeseries
run: |
python scripts/validation/check_timeseries.py \
python v1/scripts/validation/check_timeseries.py \
--file_name auto-ml-forecasting-hierarchical-timeseries.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/forecasting-hierarchical-timeseries \
--experiment_name automl-hts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ jobs:
working-directory: v1/python-sdk/tutorials/automl-with-azureml/forecasting-orange-juice-sales
- name: check notebook output
run: |
python scripts/validation/check_notebook_output.py \
python v1/scripts/validation/check_notebook_output.py \
--file_name auto-ml-forecasting-orange-juice-sales.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/forecasting-orange-juice-sales \
--check warning stderr
- name: check experiment result
run: |
python scripts/validation/check_experiment_result.py \
python v1/scripts/validation/check_experiment_result.py \
--file_name auto-ml-forecasting-orange-juice-sales.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/forecasting-orange-juice-sales \
--experiment_name automl-ojforecasting \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
working-directory: v1/python-sdk/tutorials/automl-with-azureml/forecasting-pipelines
- name: check notebook output
run: |
python scripts/validation/check_notebook_output.py \
python v1/scripts/validation/check_notebook_output.py \
--file_name auto-ml-forecasting-pipelines.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/forecasting-pipelines \
--check stderr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
working-directory: v1/python-sdk/tutorials/automl-with-azureml/forecasting-recipes-univariate
- name: check notebook output
run: |
python scripts/validation/check_notebook_output.py \
python v1/scripts/validation/check_notebook_output.py \
--file_name auto-ml-forecasting-univariate-recipe-experiment-settings.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/forecasting-recipes-univariate \
--check warning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ jobs:
working-directory: v1/python-sdk/tutorials/automl-with-azureml/forecasting-recipes-univariate
- name: check notebook output
run: |
python scripts/validation/check_notebook_output.py \
python v1/scripts/validation/check_notebook_output.py \
--file_name auto-ml-forecasting-univariate-recipe-run-experiment.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/forecasting-recipes-univariate \
--check warning stderr
- name: check experiment result
run: |
python scripts/validation/check_experiment_result.py \
python v1/scripts/validation/check_experiment_result.py \
--file_name auto-ml-forecasting-univariate-recipe-run-experiment.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/forecasting-recipes-univariate \
--experiment_name alcohol_diff-True_lags-None_STL-None \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-sdk-tutorial-auto-ml-regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ jobs:
working-directory: v1/python-sdk/tutorials/automl-with-azureml/regression
- name: check notebook output
run: |
python scripts/validation/check_notebook_output.py \
python v1/scripts/validation/check_notebook_output.py \
--file_name auto-ml-regression.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/regression \
--check warning stderr
- name: check experiment result
run: |
python scripts/validation/check_experiment_result.py \
python v1/scripts/validation/check_experiment_result.py \
--file_name auto-ml-regression.output.ipynb \
--folder v1/python-sdk/tutorials/automl-with-azureml/regression \
--experiment_name automl-regression \
Expand Down
30 changes: 14 additions & 16 deletions v1/python-sdk/tutorials/automl-with-azureml/generate_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ def get_validation_check_yml(notebook_folder, notebook_name, validation):
validation_name = validation["name"]
validation_file_name = validation_name.replace(" ", "_")
notebook_output_file = notebook_name.replace(".", ".output.")
full_folder_name = f"python-sdk/tutorials/automl-with-azureml/{notebook_folder}"
full_folder_name = f"v1/python-sdk/tutorials/automl-with-azureml/{notebook_folder}"

check_yml = f"""
- name: {validation_name}
run: |
python scripts/validation/{validation_file_name}.py \\
python v1/scripts/validation/{validation_file_name}.py \\
--file_name {notebook_output_file} \\
--folder {full_folder_name} \\"""

Expand All @@ -84,9 +84,7 @@ def write_notebook_workflow(notebook, notebook_folder, cron_schedule):
creds = "${{secrets.AZ_CREDS}}"

run_update_env = ""
update_yml_file = (
f"python-sdk/tutorials/automl-with-azureml/{notebook_folder}/{UPDATE_ENV_YML}"
)
update_yml_file = f"v1/python-sdk/tutorials/automl-with-azureml/{notebook_folder}/{UPDATE_ENV_YML}"
# some notebook needs install more packages with the basic automl requirement.
if os.path.exists(os.path.join(notebook_folder, UPDATE_ENV_YML)):
run_update_env = f"""
Expand All @@ -97,7 +95,7 @@ def write_notebook_workflow(notebook, notebook_folder, cron_schedule):
validation_yml = get_validation_yml(notebook_folder, notebook)

workflow_yaml = f"""name: {notebook_name}
# This file is generated by python-sdk/tutorials/automl-with-azureml/generate_workflows.py
# This file is generated by v1/python-sdk/tutorials/automl-with-azureml/generate_workflows.py
on:
workflow_dispatch:
schedule:
Expand All @@ -106,8 +104,8 @@ def write_notebook_workflow(notebook, notebook_folder, cron_schedule):
branches:
- main
paths:
- python-sdk/tutorials/automl-with-azureml/{notebook_folder}/**
- python-sdk/tutorials/automl-with-azureml/automl_env_linux.yml
- v1/python-sdk/tutorials/automl-with-azureml/{notebook_folder}/**
- v1/python-sdk/tutorials/automl-with-azureml/automl_env_linux.yml
- .github/workflows/python-sdk-tutorial-{notebook_name}.yml
jobs:
build:
Expand All @@ -126,14 +124,14 @@ def write_notebook_workflow(notebook, notebook_folder, cron_schedule):
python-version: "3.8"
- name: Run Install packages
run: |
chmod +x ./scripts/install-packages.sh
./scripts/install-packages.sh
chmod +x ./v1/scripts/install-packages.sh
./v1/scripts/install-packages.sh
shell: bash
- name: create automl conda environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: azure_automl
environment-file: python-sdk/tutorials/automl-with-azureml/automl_env_linux.yml
environment-file: v1/python-sdk/tutorials/automl-with-azureml/automl_env_linux.yml
auto-activate-base: false{run_update_env}
- name: install papermill and set up the IPython kernel
run: |
Expand All @@ -146,23 +144,23 @@ def write_notebook_workflow(notebook, notebook_folder, cron_schedule):
creds: {creds}
- name: Run update-azure-extensions
run: |
chmod +x ./scripts/update-azure-extensions.sh
./scripts/update-azure-extensions.sh
chmod +x ./v1/scripts/update-azure-extensions.sh
./v1/scripts/update-azure-extensions.sh
shell: bash
- name: attach to workspace
run: az ml folder attach -w main -g azureml-examples
- name: run {notebook}
run: papermill -k python {notebook} {notebook_name}.output.ipynb
working-directory: python-sdk/tutorials/automl-with-azureml/{notebook_folder}{validation_yml}
working-directory: v1/python-sdk/tutorials/automl-with-azureml/{notebook_folder}{validation_yml}
- name: upload notebook's working folder as an artifact
if: ${{{{ always() }}}}
uses: actions/upload-artifact@v2
with:
name: {notebook_name}
path: python-sdk/tutorials/automl-with-azureml/{notebook_folder}\n"""
path: v1/python-sdk/tutorials/automl-with-azureml/{notebook_folder}\n"""

workflow_file = (
f"../../../.github/workflows/python-sdk-tutorial-{notebook_name}.yml"
f"../../../../.github/workflows/python-sdk-tutorial-{notebook_name}.yml"
)
workflow_before = ""
if os.path.exists(workflow_file):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,8 @@
"outputs": [],
"source": [
"%matplotlib inline\n",
"test_pred = plt.scatter(y_test, y_pred_test, color=\"\")\n",
"test_test = plt.scatter(y_test, y_test, color=\"g\")\n",
"test_pred = plt.scatter(y_test, y_pred_test, c=[\"b\"])\n",
"test_test = plt.scatter(y_test, y_test, c=[\"g\"])\n",
"plt.legend(\n",
" (test_pred, test_test), (\"prediction\", \"truth\"), loc=\"upper left\", fontsize=8\n",
")\n",
Expand Down