From ee55127ede281a2cce164856d1af63b8c6283919 Mon Sep 17 00:00:00 2001 From: lcaggio Date: Mon, 6 Mar 2023 12:51:46 +0100 Subject: [PATCH] Fix notebook --- .../bq-ml/demo/bmql_pipeline.ipynb | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/blueprints/data-solutions/bq-ml/demo/bmql_pipeline.ipynb b/blueprints/data-solutions/bq-ml/demo/bmql_pipeline.ipynb index 44342882..ff063957 100644 --- a/blueprints/data-solutions/bq-ml/demo/bmql_pipeline.ipynb +++ b/blueprints/data-solutions/bq-ml/demo/bmql_pipeline.ipynb @@ -14,6 +14,8 @@ "metadata": {}, "outputs": [], "source": [ + "# Copyright 2023 Google LLC\n", + "#\n", "# Licensed under the Apache License, Version 2.0 (the \"License\");\n", "# you may not use this file except in compliance with the License.\n", "# You may obtain a copy of the License at\n", @@ -51,8 +53,9 @@ "outputs": [], "source": [ "import kfp\n", - "from google.cloud import aiplatform as aip\n", "import google_cloud_pipeline_components.v1.bigquery as bqop\n", + "\n", + "from google.cloud import aiplatform as aip\n", "from google.cloud import bigquery" ] }, @@ -70,18 +73,17 @@ "metadata": {}, "outputs": [], "source": [ - "PREFIX = 'your-prefix'\n", - "PROJECT_ID = 'your-project-id'\n", - "LOCATION = 'US'\n", - "REGION = 'us-central1'\n", - "PIPELINE_NAME = 'bqml-vertex-pipeline'\n", - "MODEL_NAME = 'bqml-model'\n", "EXPERIMENT_NAME = 'bqml-experiment'\n", "ENDPOINT_DISPLAY_NAME = 'bqml-endpoint'\n", - "\n", - "SERVICE_ACCOUNT = f\"vertex-sa@{PROJECT_ID}.iam.gserviceaccount.com\"\n", + "DATASET = \"{}_data\".format(PREFIX.replace(\"-\",\"_\")) \n", + "LOCATION = 'US'\n", + "MODEL_NAME = 'bqml-model'\n", + "PIPELINE_NAME = 'bqml-vertex-pipeline'\n", "PIPELINE_ROOT = f\"gs://{PREFIX}-data\"\n", - "DATASET = \"{}_data\".format(PREFIX.replace(\"-\",\"_\")) " + "PREFIX = 'your-prefix'\n", + "PROJECT_ID = 'your-project-id'\n", + "REGION = 'us-central1'\n", + "SERVICE_ACCOUNT = f\"vertex-sa@{PROJECT_ID}.iam.gserviceaccount.com\"" ] }, { @@ -97,12 +99,12 @@ "3. Evaluate the BigQuery ML model with the standard evaluation metrics\n", "\n", "The pipeline takes as input the following variables:\n", - "- ```model_name```: the display name of the BigQuery ML model\n", - "- ```split_fraction```: the percentage of data that will be used as an evaluation dataset\n", - "- ```evaluate_job_conf```: bq dict configuration to define where to store evaluation metrics\n", "- ```dataset```: name of the dataset where the artifacts will be stored\n", + "- ```evaluate_job_conf```: bq dict configuration to define where to store evaluation metrics\n", + "- ```location```: BigQuery location\n", + "- ```model_name```: the display name of the BigQuery ML model\n", "- ```project_id```: the project id where the GCP resources will be created\n", - "- ```location```: BigQuery location" + "- ```split_fraction```: the percentage of data that will be used as an evaluation dataset" ] }, { @@ -186,7 +188,7 @@ " description='This is a new experiment to keep track of bqml trainings',\n", " project=PROJECT_ID,\n", " location=REGION\n", - " )" + ")" ] }, { @@ -218,7 +220,6 @@ " template_path=f'{PIPELINE_NAME}.json',\n", " pipeline_root=PIPELINE_ROOT,\n", " enable_caching=True\n", - " \n", " )\n", "\n", " pipeline.submit(service_account=SERVICE_ACCOUNT, experiment=my_experiment)" @@ -278,7 +279,8 @@ " 'day_of_week': 'WEEKDAY',\n", " 'traffic_source': 'Facebook',\n", " 'browser': 'Firefox',\n", - " 'hour_of_day': 20}" + " 'hour_of_day': 20\n", + "}" ] }, { @@ -337,7 +339,7 @@ }, "language_info": { "name": "python", - "version": "3.10.9" + "version": "3.8.9" }, "orig_nbformat": 4, "vscode": {