Skip to content

Commit 0e4c49c

Browse files
committed
docs: link to ML.EVALUATE BQML page for score() methods (#137)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/python-bigquery-dataframes/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕
1 parent 272f0af commit 0e4c49c

File tree

5 files changed

+45
-3
lines changed

5 files changed

+45
-3
lines changed

bigframes/ml/ensemble.py

+12
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,12 @@ def score(
507507
):
508508
"""Calculate evaluation metrics of the model.
509509
510+
.. note::
511+
512+
Output matches that of the BigQuery ML.EVALUTE function.
513+
See: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate#regression_models
514+
for the outputs relevant to this model type.
515+
510516
Args:
511517
X (bigframes.dataframe.DataFrame or bigframes.series.Series):
512518
A BigQuery DataFrame as evaluation data.
@@ -676,6 +682,12 @@ def score(
676682
):
677683
"""Calculate evaluation metrics of the model.
678684
685+
.. note::
686+
687+
Output matches that of the BigQuery ML.EVALUTE function.
688+
See: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate#classification_models
689+
for the outputs relevant to this model type.
690+
679691
Args:
680692
X (bigframes.dataframe.DataFrame or bigframes.series.Series):
681693
A BigQuery DataFrame as evaluation data.

bigframes/ml/forecasting.py

+6
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ def score(
112112
) -> bpd.DataFrame:
113113
"""Calculate evaluation metrics of the model.
114114
115+
.. note::
116+
117+
Output matches that of the BigQuery ML.EVALUTE function.
118+
See: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate#time_series_models
119+
for the outputs relevant to this model type.
120+
115121
Args:
116122
X (bigframes.dataframe.DataFrame or bigframes.series.Series):
117123
A BigQuery DataFrame only contains 1 column as

third_party/bigframes_vendored/sklearn/base.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ def score(self, X, y):
8585
which is a harsh metric since you require for each sample that
8686
each label set be correctly predicted.
8787
88+
.. note::
89+
90+
Output matches that of the BigQuery ML.EVALUTE function.
91+
See: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate#classification_models
92+
for the outputs relevant to this model type.
93+
8894
Args:
8995
X (bigframes.dataframe.DataFrame or bigframes.series.Series):
9096
DataFrame of shape (n_samples, n_features). Test samples.
@@ -105,7 +111,13 @@ class RegressorMixin:
105111
_estimator_type = "regressor"
106112

107113
def score(self, X, y):
108-
"""Return the evaluation metrics of the model.
114+
"""Calculate evaluation metrics of the model.
115+
116+
.. note::
117+
118+
Output matches that of the BigQuery ML.EVALUTE function.
119+
See: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate#regression_models
120+
for the outputs relevant to this model type.
109121
110122
Args:
111123
X (bigframes.dataframe.DataFrame or bigframes.series.Series):

third_party/bigframes_vendored/sklearn/cluster/_kmeans.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,13 @@ def score(
8282
X,
8383
y=None,
8484
):
85-
"""Metrics of the model.
85+
"""Calculate evaluation metrics of the model.
86+
87+
.. note::
88+
89+
Output matches that of the BigQuery ML.EVALUTE function.
90+
See: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate#k-means_models
91+
for the outputs relevant to this model type.
8692
8793
Args:
8894
X (bigframes.dataframe.DataFrame or bigframes.series.Series):

third_party/bigframes_vendored/sklearn/decomposition/_pca.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ def fit(self, X, y=None):
5555
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
5656

5757
def score(self, X=None, y=None):
58-
"""Return the metrics of the model.
58+
"""Calculate evaluation metrics of the model.
59+
60+
.. note::
61+
62+
Output matches that of the BigQuery ML.EVALUTE function.
63+
See: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate#pca_models
64+
for the outputs relevant to this model type.
5965
6066
Args:
6167
X (default None):

0 commit comments

Comments
 (0)