statmike / vertex-ai-mlops

Google Cloud Platform Vertex AI end-to-end workflows for machine learning operations
Apache License 2.0
450 stars 202 forks source link

Review data section in 03g - Switch cell type from markdown to code #18

Closed karticn-google closed 1 year ago

karticn-google commented 1 year ago
  1. Switch cell type from Markdown to code for this cell: query = f""" WITH COUNTS as (SELECT splits, {VAR_TARGET}, count(*) as n FROM {BQ_PROJECT}.{BQ_DATASET}.{BQ_TABLE} GROUP BY splits, {VAR_TARGET}) SELECT *, SAFE_DIVIDE(n, SUM(n) OVER(PARTITION BY {VAR_TARGET})) as n_pct_class, SAFE_DIVIDE(n, SUM(n) OVER(PARTITION BY splits)) as n_pct_split, SAFE_DIVIDE(SUM(n) OVER(PARTITION BY {VAR_TARGET}), SUM(n) OVER()) as class_pct_to SUM(n) OVER() as total,tal FROM COUNTS """ review = bq.query(query = query).to_dataframe() review

  2. Add comma after to SUM(n) OVER()) as class_pct_to

  3. Remove the last attribute in the query tal

karticn-google commented 1 year ago

@statmike I have created this issue to update the cell from markdown to code and fix couple typos in the query.

statmike commented 1 year ago

Good Catch!

It looks like I was editing it as markdown and copy/pasted an extra sum(n) OVER() .. in the middle of the word total.

Corrections made and pushed this morning.