Skip to content

Instantly share code, notes, and snippets.

@securetorobert
Created May 20, 2019 02:00
Show Gist options
  • Save securetorobert/5c1bd091c330f3a0ce788a8c0fa0e550 to your computer and use it in GitHub Desktop.
Save securetorobert/5c1bd091c330f3a0ce788a8c0fa0e550 to your computer and use it in GitHub Desktop.
Generate ROC curve in BQML
SELECT
*
FROM
ML.ROC_CURVE(MODEL `bqml_tutorial.sample_model`,
(
SELECT
IF(totals.transactions IS NULL, 0, 1) AS label,
IFNULL(device.operatingSystem, "") AS os,
device.isMobile AS is_mobile,
IFNULL(geoNetwork.country, "") AS country,
IFNULL(totals.pageviews, 0) AS pageviews
FROM
`bigquery-public-data.google_analytics_sample.ga_sessions_*`
WHERE
_TABLE_SUFFIX BETWEEN '20170801' AND '20170830'),
GENERATE_ARRAY(0.4,0.6,0.01))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment