bigframes.ml.preprocessing.KBinsDiscretizer#

class bigframes.ml.preprocessing.KBinsDiscretizer(n_bins: int = 5, strategy: Literal['uniform', 'quantile'] = 'quantile')[source]#

Bin continuous data into intervals.

Parameters:
  • n_bins (int, default 5) – The number of bins to produce. Raises ValueError if n_bins < 2.

  • strategy ({'uniform', 'quantile'}, default='quantile') – Strategy used to define the widths of the bins. ‘uniform’: All bins in each feature have identical widths. ‘quantile’: All bins in each feature have the same number of points.

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

Fit the estimator.

Parameters:
Returns:

Fitted scaler.

Return type:

KBinsDiscretizer

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

Discretize the data.

Parameters:

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

Returns:

Transformed result.

Return type:

bigframes.dataframe.DataFrame