Skip to content

Instantly share code, notes, and snippets.

@gidutz
Created August 13, 2018 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gidutz/f7de19eee11478d75757e4bdc3b25001 to your computer and use it in GitHub Desktop.
Save gidutz/f7de19eee11478d75757e4bdc3b25001 to your computer and use it in GitHub Desktop.
SELECT
year,
month,
day,
cumsum,
ROUND(predicted_label) predicted,
monthly_cost actual_month_cost,
ROUND(100 * (ABS(predicted_label - monthly_cost) / monthly_cost),1) abs_err
FROM
ML.PREDICT(MODEL `billing_dataset_example.model_linear_regression`,
(
SELECT
Year, month, day, cumsum, mean_daily_cost,
ROUND(monthly_cost) monthly_cost
FROM
`billing_dataset_example.linear_regression_dataset`
WHERE
account_name = 'DoIT'
AND YEAR >= 2017))
ORDER BY
year,
month,
day
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment