Skip to content

Commit 15d1d59

Browse files
committed
update docs
1 parent bfc4fdf commit 15d1d59

File tree

3 files changed

+81
-4
lines changed

3 files changed

+81
-4
lines changed

bigframes/_config/bigquery_options.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ def credentials(self, value: Optional[google.auth.credentials.Credentials]):
161161
def location(self) -> Optional[str]:
162162
"""Default location for job, datasets, and tables.
163163
164+
>>> import bigframes.pandas as bpd
165+
>>> bpd.reset_session()
166+
>>> bpd.options.bigquery.location = "us-central1"
167+
>>> bpd.options.bigquery.location
168+
'us-central1'
169+
170+
If not set, is set to the location inferred by the first call to
171+
func:`bigframes.pandas.read_gbq` or similar. If the location can't be
172+
inferred, jobs and temporary data use the US multiregion.
173+
164174
For more information, see https://cloud.google.com/bigquery/docs/locations BigQuery locations.
165175
166176
Returns:

bigframes/ml/__init__.py

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,82 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

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+
)
1677

1778
__all__ = [
1879
"cluster",
1980
"compose",
2081
"decomposition",
82+
"ensemble",
83+
"forecasting",
84+
"imported",
85+
"impute",
2186
"linear_model",
87+
"llm",
2288
"metrics",
2389
"model_selection",
2490
"pipeline",
2591
"preprocessing",
26-
"llm",
27-
"forecasting",
28-
"imported",
2992
"remote",
3093
]

docs/reference/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ packages.
1010
bigframes._config
1111
bigframes.bigquery
1212
bigframes.bigquery.ai
13+
bigframes.bigquery.ml
1314
bigframes.enums
1415
bigframes.exceptions
1516
bigframes.geopandas
@@ -26,6 +27,8 @@ scikit-learn.
2627
.. autosummary::
2728
:toctree: api
2829

30+
bigframes.ml
31+
bigframes.ml.base
2932
bigframes.ml.cluster
3033
bigframes.ml.compose
3134
bigframes.ml.decomposition
@@ -35,6 +38,7 @@ scikit-learn.
3538
bigframes.ml.impute
3639
bigframes.ml.linear_model
3740
bigframes.ml.llm
41+
bigframes.ml.metrics
3842
bigframes.ml.model_selection
3943
bigframes.ml.pipeline
4044
bigframes.ml.preprocessing

0 commit comments

Comments
 (0)