
6 min read
Subscribe to our monthly newsletter to get the latest updates in your inbox
Visualization after using ML.BUCKETIZE [sourcecode language="sql" highlight="2"] SELECT ML.BUCKETIZE(weight_pounds, [3,4,5,6,7,8,9,10]) weight_pounds_group, COUNT(*) AS births FROM `bigquery-public-data.samples.natality` WHERE weight_pounds IS NOT NULL GROUP BY 1 ORDER BY 1 ASC [/sourcecode]
The ML.BUCKETIZE saves us from a tedious CASE WHEN statement, or a more mathematical transformation and elegantly solves the problem. We could also take our ML.BUCKETIZE a step further by replacing the input array with GENERATE_ARRAY(3, 10, 1). *The bucket naming is currently preset to bin_<bucket number>.
Find a time to talk media, measurement or both!
Our media geniuses, analytics savants and industry-leading data scientists have deep expertise and a passion for helping our clients use it effectively. And they'd love to help you achieve your marketing goals.