Skip to content

docs: address more technical writers' feedback #640

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 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bigframes/ml/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ def to_gbq(self, model_name: str, replace: bool = False) -> KMeans:

Args:
model_name (str):
the name of the model.
The name of the model.
replace (bool, default False):
Determine whether to replace if the model already exists. Default to False.

Returns:
KMeans: saved model."""
KMeans: Saved model."""
if not self._bqml_model:
raise RuntimeError("A model must be fitted before it can be saved")

Expand Down
4 changes: 2 additions & 2 deletions bigframes/ml/decomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ def to_gbq(self, model_name: str, replace: bool = False) -> PCA:

Args:
model_name (str):
the name of the model.
The name of the model.
replace (bool, default False):
Determine whether to replace if the model already exists. Default to False.

Returns:
PCA: saved model."""
PCA: Saved model."""
if not self._bqml_model:
raise RuntimeError("A model must be fitted before it can be saved")

Expand Down
2 changes: 1 addition & 1 deletion bigframes/ml/forecasting.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def to_gbq(self, model_name: str, replace: bool = False) -> ARIMAPlus:

Args:
model_name (str):
the name of the model.
The name of the model.
replace (bool, default False):
Determine whether to replace if the model already exists. Default to False.

Expand Down
6 changes: 3 additions & 3 deletions bigframes/ml/imported.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def to_gbq(self, model_name: str, replace: bool = False) -> TensorFlowModel:

Args:
model_name (str):
the name of the model.
The name of the model.
replace (bool, default False):
Default to False.

Expand Down Expand Up @@ -166,7 +166,7 @@ def to_gbq(self, model_name: str, replace: bool = False) -> ONNXModel:

Args:
model_name (str):
the name of the model.
The name of the model.
replace (bool, default False):
Determine whether to replace if the model already exists. Default to False.

Expand Down Expand Up @@ -282,7 +282,7 @@ def to_gbq(self, model_name: str, replace: bool = False) -> XGBoostModel:

Args:
model_name (str):
the name of the model.
The name of the model.
replace (bool, default False):
Determine whether to replace if the model already exists. Default to False.

Expand Down
8 changes: 4 additions & 4 deletions bigframes/ml/linear_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ def to_gbq(self, model_name: str, replace: bool = False) -> LinearRegression:

Args:
model_name (str):
the name of the model.
The name of the model.
replace (bool, default False):
Determine whether to replace if the model already exists. Default to False.

Returns:
LinearRegression: saved model."""
LinearRegression: Saved model."""
if not self._bqml_model:
raise RuntimeError("A model must be fitted before it can be saved")

Expand Down Expand Up @@ -347,12 +347,12 @@ def to_gbq(self, model_name: str, replace: bool = False) -> LogisticRegression:

Args:
model_name (str):
the name of the model.
The name of the model.
replace (bool, default False):
Determine whether to replace if the model already exists. Default to False.

Returns:
LogisticRegression: saved model."""
LogisticRegression: Saved model."""
if not self._bqml_model:
raise RuntimeError("A model must be fitted before it can be saved")

Expand Down
28 changes: 14 additions & 14 deletions bigframes/ml/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class PaLM2TextGenerator(base.BaseEstimator):
BQ session to create the model. If None, use the global default session.
connection_name (str or None):
Connection to connect with remote service. str of the format <PROJECT_NUMBER/PROJECT_ID>.<LOCATION>.<CONNECTION_ID>.
if None, use default connection in session context. BigQuery DataFrame will try to create the connection and attach
permission if the connection isn't fully setup.
If None, use default connection in session context. BigQuery DataFrame will try to create the connection and attach
permission if the connection isn't fully set up.
max_iterations (Optional[int], Default to 300):
The number of steps to run when performing supervised tuning.
"""
Expand Down Expand Up @@ -191,7 +191,7 @@ def fit(
Training labels.

Returns:
PaLM2TextGenerator: Fitted Estimator.
PaLM2TextGenerator: Fitted estimator.
"""
X, y = utils.convert_to_dataframe(X, y)

Expand Down Expand Up @@ -372,12 +372,12 @@ def to_gbq(self, model_name: str, replace: bool = False) -> PaLM2TextGenerator:

Args:
model_name (str):
the name of the model.
The name of the model.
replace (bool, default False):
Determine whether to replace if the model already exists. Default to False.

Returns:
PaLM2TextGenerator: saved model."""
PaLM2TextGenerator: Saved model."""

new_model = self._bqml_model.copy(model_name, replace)
return new_model.session.read_gbq_model(model_name)
Expand All @@ -390,16 +390,16 @@ class PaLM2TextEmbeddingGenerator(base.BaseEstimator):
Args:
model_name (str, Default to "textembedding-gecko"):
The model for text embedding. “textembedding-gecko” returns model embeddings for text inputs.
"textembedding-gecko-multilingual" returns model embeddings for text inputs which support over 100 languages
"textembedding-gecko-multilingual" returns model embeddings for text inputs which support over 100 languages.
Default to "textembedding-gecko".
version (str or None):
Model version. Accepted values are "001", "002", "003", "latest" etc. Will use the default version if unset.
See https://cloud.google.com/vertex-ai/docs/generative-ai/learn/model-versioning for details.
session (bigframes.Session or None):
BQ session to create the model. If None, use the global default session.
connection_name (str or None):
connection to connect with remote service. str of the format <PROJECT_NUMBER/PROJECT_ID>.<LOCATION>.<CONNECTION_ID>.
if None, use default connection in session context.
Connection to connect with remote service. str of the format <PROJECT_NUMBER/PROJECT_ID>.<LOCATION>.<CONNECTION_ID>.
If None, use default connection in session context.
"""

def __init__(
Expand Down Expand Up @@ -539,12 +539,12 @@ def to_gbq(

Args:
model_name (str):
the name of the model.
The name of the model.
replace (bool, default False):
Determine whether to replace if the model already exists. Default to False.

Returns:
PaLM2TextEmbeddingGenerator: saved model."""
PaLM2TextEmbeddingGenerator: Saved model."""

new_model = self._bqml_model.copy(model_name, replace)
return new_model.session.read_gbq_model(model_name)
Expand All @@ -565,8 +565,8 @@ class GeminiTextGenerator(base.BaseEstimator):
BQ session to create the model. If None, use the global default session.
connection_name (str or None):
Connection to connect with remote service. str of the format <PROJECT_NUMBER/PROJECT_ID>.<LOCATION>.<CONNECTION_ID>.
if None, use default connection in session context. BigQuery DataFrame will try to create the connection and attach
permission if the connection isn't fully setup.
If None, use default connection in session context. BigQuery DataFrame will try to create the connection and attach
permission if the connection isn't fully set up.
"""

def __init__(
Expand Down Expand Up @@ -719,12 +719,12 @@ def to_gbq(self, model_name: str, replace: bool = False) -> GeminiTextGenerator:

Args:
model_name (str):
the name of the model.
The name of the model.
replace (bool, default False):
Determine whether to replace if the model already exists. Default to False.

Returns:
GeminiTextGenerator: saved model."""
GeminiTextGenerator: Saved model."""

new_model = self._bqml_model.copy(model_name, replace)
return new_model.session.read_gbq_model(model_name)
6 changes: 3 additions & 3 deletions bigframes/ml/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ def to_gbq(self, model_name: str, replace: bool = False) -> Pipeline:

Args:
model_name (str):
the name of the model(pipeline).
The name of the model(pipeline).
replace (bool, default False):
whether to replace if the model(pipeline) already exists. Default to False.
Whether to replace if the model(pipeline) already exists. Default to False.

Returns:
Pipeline: saved model(pipeline)."""
Pipeline: Saved model(pipeline)."""
if not self._estimator._bqml_model:
raise RuntimeError("A model must be fitted before it can be saved")

Expand Down
10 changes: 5 additions & 5 deletions bigframes/ml/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@

@log_adapter.class_logger
class VertexAIModel(base.BaseEstimator):
"""Remote model from a Vertex AI https endpoint. User must specify https endpoint, input schema and output schema.
How to deploy a model in Vertex AI https://cloud.google.com/bigquery/docs/bigquery-ml-remote-model-tutorial#Deploy-Model-on-Vertex-AI.
"""Remote model from a Vertex AI HTTPS endpoint. User must specify HTTPS endpoint, input schema and output schema.
For more information, see Deploy model on Vertex AI: https://cloud.google.com/bigquery/docs/bigquery-ml-remote-model-tutorial#Deploy-Model-on-Vertex-AI.

Args:
endpoint (str):
Vertex AI https endpoint.
Vertex AI HTTPS endpoint.
input (Mapping):
Input schema: `{column_name: column_type}`. Supported types are "bool", "string", "int64", "float64", "array<bool>", "array<string>", "array<int64>", "array<float64>".
output (Mapping):
Expand All @@ -44,8 +44,8 @@ class VertexAIModel(base.BaseEstimator):
BQ session to create the model. If None, use the global default session.
connection_name (str or None):
Connection to connect with remote service. str of the format <PROJECT_NUMBER/PROJECT_ID>.<LOCATION>.<CONNECTION_ID>.
if None, use default connection in session context. BigQuery DataFrame will try to create the connection and attach
permission if the connection isn't fully setup.
If None, use default connection in session context. BigQuery DataFrame will try to create the connection and attach
permission if the connection isn't fully set up.
"""

def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def fit(
Not used, present here for API consistency by convention.

Returns:
KMeans: Fitted Estimator.
KMeans: Fitted estimator.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def fit(self, X, y):


Returns:
ForestModel: Fitted Estimator.
ForestModel: Fitted estimator.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,6 @@ def fit(
Target values. Will be cast to X's dtype if necessary.

Returns:
LinearRegression: Fitted Estimator.
LinearRegression: Fitted estimator.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ def fit(


Returns:
LogisticRegression: Fitted Estimator.
LogisticRegression: Fitted estimator.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
6 changes: 3 additions & 3 deletions third_party/bigframes_vendored/sklearn/metrics/pairwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def paired_cosine_distances(X, Y) -> bpd.DataFrame:
Input data. X and Y are mapped by indexes, must have the same index.

Returns:
bigframes.dataframe.DataFrame: DataFrame with columns of X, Y and cosine_distance
bigframes.dataframe.DataFrame: DataFrame with columns of X, Y and cosine_distance.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand All @@ -36,7 +36,7 @@ def paired_manhattan_distance(X, Y) -> bpd.DataFrame:
Input data. X and Y are mapped by indexes, must have the same index.

Returns:
bigframes.dataframe.DataFrame: DataFrame with columns of X, Y and manhattan_distance
bigframes.dataframe.DataFrame: DataFrame with columns of X, Y and manhattan_distance.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand All @@ -51,6 +51,6 @@ def paired_euclidean_distances(X, Y) -> bpd.DataFrame:
Input data. X and Y are mapped by indexes, must have the same index.

Returns:
bigframes.dataframe.DataFrame: DataFrame with columns of X, Y and euclidean_distance
bigframes.dataframe.DataFrame: DataFrame with columns of X, Y and euclidean_distance.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
5 changes: 2 additions & 3 deletions third_party/bigframes_vendored/sklearn/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ class Pipeline(BaseEstimator, metaclass=ABCMeta):
The final estimator only needs to implement `fit`.

The purpose of the pipeline is to assemble several steps that can be
cross-validated together while setting different parameters. This
simplifies code and allows for deploying an estimator and peprocessing
together, e.g. with `Pipeline.to_gbq(...).`
cross-validated together while setting different parameters. This simplifies code and allows for
deploying an estimator and preprocessing together, e.g. with `Pipeline.to_gbq(...).`
"""

def fit(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ def transform(self, X):
The DataFrame or Series to be transformed.

Returns:
bigframes.dataframe.DataFrame: The result is categorized as index: number, value: number.
Where index is the position of the dict that seeing the category, and value is 0 or 1."""
bigframes.dataframe.DataFrame: The result is categorized as index: number, value: number,
where index is the position of the dict seeing the category, and value is 0 or 1."""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
2 changes: 1 addition & 1 deletion third_party/bigframes_vendored/xgboost/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def fit(self, X, y):
Target values. Will be cast to X's dtype if necessary.

Returns:
XGBModel: Fitted Estimator.
XGBModel: Fitted estimator.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down