Conversation
|
Here is the summary of changes. You are about to add 3 region tags.
This comment is generated by snippet-bot.
|
Co-authored-by: Tim Swast <swast@google.com>
Co-authored-by: Tim Swast <swast@google.com>
tswast
left a comment
There was a problem hiding this comment.
Looking good, but a few comments regarding the comments.
| # value. | ||
| cluster_model = KMeans(n_clusters=4) | ||
| cluster_model.fit(stationstats) | ||
|
|
There was a problem hiding this comment.
Let's do a to_gbq() here to save the model to a permanent location.
It should look very similar to the getting started tutorial:
There was a problem hiding this comment.
Added to_gbq() to save the model.
Co-authored-by: Tim Swast <swast@google.com>
| @@ -0,0 +1,151 @@ | |||
| # Copyright 2023 Google LLC | |||
There was a problem hiding this comment.
It's 2024 now. These headers should reflect when the text was first written.
| # Copyright 2023 Google LLC | |
| # Copyright 2024 Google LLC |
| cluster_model = KMeans(n_clusters=4) | ||
| cluster_model.fit(stationstats) | ||
| cluster_model.to_gbq( | ||
| your_gcp_project_id, # For example: "bqml_tutorial.sample_model" |
There was a problem hiding this comment.
Project ID isn't sufficient. We want a model ID.
| # from BigQuery, but you could also use the `cluster_model` object from | ||
| # previous steps. | ||
| cluster_model = bpd.read_gbq_model( | ||
| your_gcp_project_id, |
There was a problem hiding this comment.
Not project ID. This should be the same model ID as the one we use in to_gbq above (once you change that).
tswast
left a comment
There was a problem hiding this comment.
LGTM, but let's wait for e2e tests to pass before merging.
| # limitations under the License. | ||
|
|
||
|
|
||
| def test_kmeans_sample(project_id: str, random_model_id: str): |
There was a problem hiding this comment.
The test failure on samples/snippets/create_kmeans_model_test.py is a real one. We need to create a random_model_id_eu fixture.
> raise exceptions.from_http_response(response)
E google.api_core.exceptions.NotFound: 404 POST [https://bigquery.googleapis.com/bigquery/v2/projects/bigframes-load-testing/jobs?prettyPrint=false](https://www.google.com/url?q=https://bigquery.googleapis.com/bigquery/v2/projects/bigframes-load-testing/jobs?prettyPrint%3Dfalse&sa=D): Not found: Dataset bigframes-load-testing:python_bigquery_dataframes_samples_snippets_20240223223225_52ccfc was not found in location EU
E
E Location: EU
E Job ID: 3a8974a6-1007-483a-97f0-2e9c267f17e4
[.nox/samples-3-9/lib/python3.9/site-packages/google/cloud/_http/__init__.py:494](https://cs.corp.google.com/piper///depot/google3/.nox/samples-3-9/lib/python3.9/site-packages/google/cloud/_http/__init__.py?l=494): NotFound
tswast
left a comment
There was a problem hiding this comment.
Love it! Thanks for your work on this.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕