Skip to content

docs: link to ML.EVALUATE BQML page for score() methods #137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 26, 2023
12 changes: 12 additions & 0 deletions bigframes/ml/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,12 @@ def score(
):
"""Calculate evaluation metrics of the model.

.. note::

Output matches that of the BigQuery ML.EVALUTE function.
See: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate#regression_models
for the outputs relevant to this model type.

Args:
X (bigframes.dataframe.DataFrame or bigframes.series.Series):
A BigQuery DataFrame as evaluation data.
Expand Down Expand Up @@ -676,6 +682,12 @@ def score(
):
"""Calculate evaluation metrics of the model.

.. note::

Output matches that of the BigQuery ML.EVALUTE function.
See: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate#classification_models
for the outputs relevant to this model type.

Args:
X (bigframes.dataframe.DataFrame or bigframes.series.Series):
A BigQuery DataFrame as evaluation data.
Expand Down
6 changes: 6 additions & 0 deletions bigframes/ml/forecasting.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ def score(
) -> bpd.DataFrame:
"""Calculate evaluation metrics of the model.

.. note::

Output matches that of the BigQuery ML.EVALUTE function.
See: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate#time_series_models
for the outputs relevant to this model type.

Args:
X (bigframes.dataframe.DataFrame or bigframes.series.Series):
A BigQuery DataFrame only contains 1 column as
Expand Down
14 changes: 13 additions & 1 deletion third_party/bigframes_vendored/sklearn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ def score(self, X, y):
which is a harsh metric since you require for each sample that
each label set be correctly predicted.

.. note::

Output matches that of the BigQuery ML.EVALUTE function.
See: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate#classification_models
for the outputs relevant to this model type.

Args:
X (bigframes.dataframe.DataFrame or bigframes.series.Series):
DataFrame of shape (n_samples, n_features). Test samples.
Expand All @@ -105,7 +111,13 @@ class RegressorMixin:
_estimator_type = "regressor"

def score(self, X, y):
"""Return the evaluation metrics of the model.
"""Calculate evaluation metrics of the model.

.. note::

Output matches that of the BigQuery ML.EVALUTE function.
See: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate#regression_models
for the outputs relevant to this model type.

Args:
X (bigframes.dataframe.DataFrame or bigframes.series.Series):
Expand Down
9 changes: 7 additions & 2 deletions third_party/bigframes_vendored/sklearn/cluster/_kmeans.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# License: BSD 3 clause

from abc import ABC
from typing import List, Optional

from bigframes import constants
from third_party.bigframes_vendored.sklearn.base import BaseEstimator
Expand Down Expand Up @@ -83,7 +82,13 @@ def score(
X,
y=None,
):
"""Metrics of the model.
"""Calculate evaluation metrics of the model.

.. note::

Output matches that of the BigQuery ML.EVALUTE function.
See: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate#k-means_models
for the outputs relevant to this model type.

Args:
X (bigframes.dataframe.DataFrame or bigframes.series.Series):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ def fit(self, X, y=None):
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

def score(self, X=None, y=None):
"""Return the metrics of the model.
"""Calculate evaluation metrics of the model.

.. note::

Output matches that of the BigQuery ML.EVALUTE function.
See: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate#pca_models
for the outputs relevant to this model type.

Args:
X (default None):
Expand Down