Is it possible to use different sample weights for each row when fitting linear (ridge) regression in BigQuery ML?

Viewed 27

We are fitting the following example linear regression in BigQuery ML using the l2_reg parameter for "ridge" regression:

CREATE OR REPLACE MODEL `models.test_model`
  OPTIONS (
    model_type='linear_reg',
    l2_reg = 10
  ) AS
(
  select 3.4 as label, 1 as wt, 23 as x1, 8 as x2 union all
  select 2.4 as label, 1 as wt, 13 as x1, 23 as x2 union all
  select 1.6 as label, 1 as wt, 53 as x1, 52 as x2 union all
  select 6.5 as label, 2 as wt, 43 as x1, 12 as x2 union all
  select 4.2 as label, 2 as wt, 25 as x1, 23 as x2 union all
  select 5.2 as label, 2 as wt, 17 as x1, 35 as x2
)

We would like to fit a weighted ridge regression model, where the errors are weighted using the wt column. Certain rows in our data are of more importance than others, and using the wt column to assign weights to errors for each row will allow us to take row-importance into consideration. Tools like scikit learn in python allow for sample_weights for each observation. Is this possible with BQML with linear regression?

0 Answers
Related