Created
November 15, 2019 13:58
-
-
Save juri96/c709e167b03ca86aa56da549d6a68d5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH dataset AS (SELECT pm25, | |
pm10, | |
so2, | |
co, | |
o3, | |
temp, | |
press, | |
dewp, | |
rain, | |
timestamp, | |
station | |
FROM `GCP_PROJECT_NAME.DATASET_NAME.measurements` | |
WHERE pm25 IS NOT NULL | |
AND pm10 IS NOT NULL | |
AND so2 IS NOT NULL | |
AND co IS NOT NULL | |
AND o3 IS NOT NULL | |
AND temp IS NOT NULL | |
AND press IS NOT NULL | |
AND dewp IS NOT NULL | |
AND rain IS NOT NULL | |
AND timestamp IS NOT NULL | |
AND station IS NOT NULL | |
) | |
SELECT * EXCEPT (nearest_centroids_distance) FROM | |
ML.PREDICT(MODEL `GCP_PROJECT_NAME.DATASET_NAME.pollution_kmeans`, | |
( | |
SELECT timestamp, station, pm25, pm10, so2, co, o3, temp, press, rain, dewp | |
FROM dataset | |
) | |
) | |
ORDER BY station, timestamp DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment