Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on May 7, 2026. It is now read-only.
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
7 changes: 7 additions & 0 deletions 7 bigframes/ml/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,13 @@ def fit(
) -> _T:
return self._fit(X, y)

def fit_predict(
self: _T,
X: utils.ArrayType,
y: Optional[utils.ArrayType] = None,
) -> _T:
return self.fit(X).predict(X)


class RetriableRemotePredictor(BaseEstimator):
def _predict_and_retry(
Expand Down
4 changes: 2 additions & 2 deletions 4 notebooks/generative_ai/bq_dataframes_llm_kmeans.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1736,7 +1736,7 @@
"provenance": []
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "venv (3.10.14)",
"language": "python",
"name": "python3"
},
Expand All @@ -1750,7 +1750,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.10.14"
}
},
"nbformat": 4,
Expand Down
20 changes: 20 additions & 0 deletions 20 third_party/bigframes_vendored/sklearn/cluster/_kmeans.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,26 @@ def predict(
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

def fit_predict(
self,
X,
y=None,
):
"""Compute cluster centers and predict cluster index for each sample.

Convenience method; equivalent to calling fit(X) followed by predict(X).

Args:
X (bigframes.dataframe.DataFrame or bigframes.series.Series or pandas.core.frame.DataFrame or pandas.core.series.Series):
DataFrame of shape (n_samples, n_features). Training data.
y (default None):
Not used, present here for API consistency by convention.

Returns:
bigframes.dataframe.DataFrame: DataFrame of shape (n_samples, n_input_columns + n_prediction_columns). Returns predicted labels.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

def score(
self,
X,
Expand Down
20 changes: 20 additions & 0 deletions 20 third_party/bigframes_vendored/sklearn/decomposition/_mf.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,23 @@ def predict(self, X):
Returns:
bigframes.dataframe.DataFrame: Predicted DataFrames."""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

def fit_predict(
self,
X,
y=None,
):
"""Fit the model with X and generate a predicted rating for every user-item row combination for a matrix factorization model. on X.

Convenience method; equivalent to calling fit(X) followed by predict(X).

Args:
X (bigframes.dataframe.DataFrame or bigframes.series.Series or pandas.core.frame.DataFrame or pandas.core.series.Series):
DataFrame of shape (n_samples, n_features). Training data.
y (default None):
Not used, present here for API consistency by convention.

Returns:
bigframes.dataframe.DataFrame: DataFrame of shape (n_samples, n_input_columns + n_prediction_columns). Returns predicted labels.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
20 changes: 20 additions & 0 deletions 20 third_party/bigframes_vendored/sklearn/decomposition/_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,26 @@ def predict(self, X):
bigframes.dataframe.DataFrame: Predicted DataFrames."""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

def fit_predict(
self,
X,
y=None,
):
"""Fit the model with X and apply the dimensionality reduction on X.

Convenience method; equivalent to calling fit(X) followed by predict(X).

Args:
X (bigframes.dataframe.DataFrame or bigframes.series.Series or pandas.core.frame.DataFrame or pandas.core.series.Series):
DataFrame of shape (n_samples, n_features). Training data.
y (default None):
Not used, present here for API consistency by convention.

Returns:
bigframes.dataframe.DataFrame: DataFrame of shape (n_samples, n_input_columns + n_prediction_columns). Returns predicted labels.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

@property
def components_(self):
"""Principal axes in feature space, representing the directions of maximum variance in the data.
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.