From a9bb717554b328439cbbb3b437840daea354a458 Mon Sep 17 00:00:00 2001 From: Giorgio Conte Date: Tue, 7 Mar 2023 14:20:48 +0000 Subject: [PATCH] minor fix on bqml demo --- .../bq-ml/demo/bmql_pipeline.ipynb | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/blueprints/data-solutions/bq-ml/demo/bmql_pipeline.ipynb b/blueprints/data-solutions/bq-ml/demo/bmql_pipeline.ipynb index 4d3f5b53..aa494da5 100644 --- a/blueprints/data-solutions/bq-ml/demo/bmql_pipeline.ipynb +++ b/blueprints/data-solutions/bq-ml/demo/bmql_pipeline.ipynb @@ -73,15 +73,24 @@ "metadata": {}, "outputs": [], "source": [ + "# Set your variables\n", + "PREFIX = 'your-prefix'\n", + "PROJECT_ID = 'your-project-id'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "DATASET = \"{}_data\".format(PREFIX.replace(\"-\",\"_\")) \n", "EXPERIMENT_NAME = 'bqml-experiment'\n", "ENDPOINT_DISPLAY_NAME = 'bqml-endpoint'\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", - "PREFIX = 'your-prefix'\n", - "PROJECT_ID = 'your-project-id'\n", "REGION = 'us-central1'\n", "SERVICE_ACCOUNT = f\"vertex-sa@{PROJECT_ID}.iam.gserviceaccount.com\"" ] @@ -227,7 +236,6 @@ " project=project_id,\n", " location=location,\n", " query=features_query.format(dataset=dataset, project_id=project_id),\n", - " #job_configuration_query = {\"writeDisposition\": \"WRITE_TRUNCATE\"} #, \"destinationTable\":{\"projectId\":project_id,\"datasetId\":dataset,\"tableId\":\"ecommerce_abt_table\"}} #{\"destinationTable\":{\"projectId\":\"project_id\",\"datasetId\":dataset,\"tableId\":\"ecommerce_abt_table\"}}, #\"writeDisposition\": \"WRITE_TRUNCATE\", \n", "\n", " ).after(create_dataset)\n", "\n", @@ -408,9 +416,6 @@ "source": [ "# batch prediction on BigQuery\n", "\n", - "with open(\"sql/explain_predict.sql\") as file:\n", - " explain_predict_query = file.read()\n", - "\n", "client = bigquery_client = bigquery.Client(location=LOCATION, project=PROJECT_ID)\n", "batch_predictions = bigquery_client.query(\n", " explain_predict_query.format(\n",