Machine Learning with BigQuery ML by Alessandro Marrandino

Machine Learning with BigQuery ML by Alessandro Marrandino

Author:Alessandro Marrandino
Language: eng
Format: epub
Publisher: Packt Publishing Pvt. Ltd.
Published: 2021-05-14T00:00:00+00:00


Using the multiclass logistic regression model

In this section, we'll test our ML model and analyze the results.

To use our BigQuery ML model, we'll use the ML.PREDICT function and the classification_table table, which hosts the records, to test our model, as seen in the following code block:

SELECT

tree_id,

actual_label,

predicted_label_probs,

predicted_label

FROM

ML.PREDICT (MODEL `06_nyc_trees.classification_model_version_3`,

(

SELECT

tree_id,

zip_city,

tree_dbh,

boroname,

nta_name,

health,

sidewalk,

spc_latin as actual_label

FROM

`06_nyc_trees.classification_table`

));

The query statement is composed of the SELECT keyword, which extracts the tree_id, the actual value of the species in the field, actual_label, and the predicted fields predicted_label_probs and predicted_label.

The ML.PREDICT function is applied to the SELECT statement, which extracts the features and the actual species from the classification_table. The actual_label field will be used only as a benchmark for our predictions and not during the prediction phase.

In the following screenshot, we can see the structure of a record gotten from the execution of the previous query:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.