bigframes.ml#

BigQuery DataFrames ML provides a SKLearn-like API on the BigQuery engine.

from bigframes.ml.linear_model import LinearRegression
model = LinearRegression()
model.fit(feature_columns, label_columns)
model.predict(feature_columns_from_test_data)

You can also save your fit parameters to BigQuery for later use.

import bigframes.pandas as bpd
model.to_gbq(
    your_model_id,  # For example: "bqml_tutorial.penguins_model"
    replace=True,
)
saved_model = bpd.read_gbq_model(your_model_id)
saved_model.predict(feature_columns_from_test_data)

See the BigQuery ML linear regression tutorial for a detailed example.

See also the references for bigframes.ml sub-modules:

Alternatively, check out mod:bigframes.bigquery.ml for an interface that is more similar to the BigQuery ML SQL syntax.