|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | | -"""BigQuery DataFrames ML provides a SKLearn-like API on the BigQuery engine.""" |
| 15 | +"""BigQuery DataFrames ML provides a SKLearn-like API on the BigQuery engine. |
| 16 | +
|
| 17 | +.. code:: python |
| 18 | +
|
| 19 | + from bigframes.ml.linear_model import LinearRegression |
| 20 | + model = LinearRegression() |
| 21 | + model.fit(feature_columns, label_columns) |
| 22 | + model.predict(feature_columns_from_test_data) |
| 23 | +
|
| 24 | +You can also save your fit parameters to BigQuery for later use. |
| 25 | +
|
| 26 | +.. code:: python |
| 27 | +
|
| 28 | + import bigframes.pandas as bpd |
| 29 | + model.to_gbq( |
| 30 | + your_model_id, # For example: "bqml_tutorial.penguins_model" |
| 31 | + replace=True, |
| 32 | + ) |
| 33 | + saved_model = bpd.read_gbq_model(your_model_id) |
| 34 | + saved_model.predict(feature_columns_from_test_data) |
| 35 | +
|
| 36 | +See the `BigQuery ML linear regression tutorial |
| 37 | +<https://docs.cloud.google.com/bigquery/docs/linear-regression-tutorial>`_ for a |
| 38 | +detailed example. |
| 39 | +
|
| 40 | +See all, the references for ``bigframes.ml`` sub-modules: |
| 41 | +
|
| 42 | +* :mod:`bigframes.ml.cluster` |
| 43 | +* :mod:`bigframes.ml.compose` |
| 44 | +* :mod:`bigframes.ml.decomposition` |
| 45 | +* :mod:`bigframes.ml.ensemble` |
| 46 | +* :mod:`bigframes.ml.forecasting` |
| 47 | +* :mod:`bigframes.ml.imported` |
| 48 | +* :mod:`bigframes.ml.impute` |
| 49 | +* :mod:`bigframes.ml.linear_model` |
| 50 | +* :mod:`bigframes.ml.llm` |
| 51 | +* :mod:`bigframes.ml.metrics` |
| 52 | +* :mod:`bigframes.ml.model_selection` |
| 53 | +* :mod:`bigframes.ml.pipeline` |
| 54 | +* :mod:`bigframes.ml.preprocessing` |
| 55 | +* :mod:`bigframes.ml.remote` |
| 56 | +
|
| 57 | +Alternatively, check out mod:`bigframes.bigquery.ml` for an interface that is |
| 58 | +more similar to the BigQuery ML SQL syntax. |
| 59 | +""" |
| 60 | + |
| 61 | +from bigframes.ml import ( |
| 62 | + cluster, |
| 63 | + compose, |
| 64 | + decomposition, |
| 65 | + ensemble, |
| 66 | + forecasting, |
| 67 | + imported, |
| 68 | + impute, |
| 69 | + linear_model, |
| 70 | + llm, |
| 71 | + metrics, |
| 72 | + model_selection, |
| 73 | + pipeline, |
| 74 | + preprocessing, |
| 75 | + remote, |
| 76 | +) |
16 | 77 |
|
17 | 78 | __all__ = [ |
18 | 79 | "cluster", |
19 | 80 | "compose", |
20 | 81 | "decomposition", |
| 82 | + "ensemble", |
| 83 | + "forecasting", |
| 84 | + "imported", |
| 85 | + "impute", |
21 | 86 | "linear_model", |
| 87 | + "llm", |
22 | 88 | "metrics", |
23 | 89 | "model_selection", |
24 | 90 | "pipeline", |
25 | 91 | "preprocessing", |
26 | | - "llm", |
27 | | - "forecasting", |
28 | | - "imported", |
29 | 92 | "remote", |
30 | 93 | ] |
0 commit comments