bigframes.ml.compose.ColumnTransformer#

class bigframes.ml.compose.ColumnTransformer(transformers: Iterable[Tuple[str, OneHotEncoder | StandardScaler | MaxAbsScaler | MinMaxScaler | KBinsDiscretizer | LabelEncoder | PolynomialFeatures | SimpleImputer | SQLScalarColumnTransformer, str | Iterable[str]]])[source]#

Applies transformers to columns of BigQuery DataFrames.

This estimator allows different columns or column subsets of the input to be transformed separately, and the features generated by each transformer will be concatenated to form a single feature space. This is useful for heterogeneous or columnar data to combine several feature extraction mechanisms or transformations into a single transformer.

Parameters:

transformers – List of (name, transformer, columns) tuples specifying the transformer objects to be applied to subsets of the data.

fit(X: DataFrame | Series | DataFrame | Series, y=None) → ColumnTransformer[source]#

Fit all transformers using X.

Parameters:

X (bigframes.dataframe.DataFrame or bigframes.series.Series or pandas.core.frame.DataFrame or pandas.core.series.Series) – The Series or DataFrame of shape (n_samples, n_features). Training vector, where n_samples is the number of samples and n_features is the number of features.

Returns:

Fitted estimator.

Return type:

ColumnTransformer

to_gbq(model_name: str, replace: bool = False) → _T#

Save the transformer as a BigQuery model.

Parameters:
  • model_name (str) – The name of the model.

  • replace (bool, default False) – Determine whether to replace if the model already exists. Default to False.

Returns:

Saved transformer.

transform(X: DataFrame | Series | DataFrame | Series) → DataFrame[source]#

Transform X separately by each transformer, concatenate results.

Parameters:

X (bigframes.dataframe.DataFrame or bigframes.series.Series or pandas.core.frame.DataFrame or pandas.core.series.Series) – The Series or DataFrame to be transformed by subset.

Returns:

Transformed result.

Return type:

bigframes.dataframe.DataFrame

property transformers_: List[Tuple[str, OneHotEncoder | StandardScaler | MaxAbsScaler | MinMaxScaler | KBinsDiscretizer | LabelEncoder | PolynomialFeatures | SimpleImputer | SQLScalarColumnTransformer, str]]#

The collection of transformers as tuples of (name, transformer, column).