bigframes.ml.preprocessing.LabelEncoder#
- class bigframes.ml.preprocessing.LabelEncoder(min_frequency: int | None = None, max_categories: int | None = None)[source]#
Encode target labels with value between 0 and n_classes-1.
This transformer should be used to encode target values, i.e. y, and not the input X.
- Parameters:
min_frequency (Optional[int], default None) – Specifies the minimum frequency below which a category will be considered infrequent. Default None. int: categories with a smaller cardinality will be considered infrequent as ßindex 0.
max_categories (Optional[int], default None) – Specifies an upper limit to the number of output features for each input feature when considering infrequent categories. If there are infrequent categories, max_categories includes the category representing the infrequent categories along with the frequent categories. Default None. Set limit to 1,000,000.
- fit(y: DataFrame | Series | DataFrame | Series) LabelEncoder[source]#
Fit label encoder.
- Parameters:
y (bigframes.dataframe.DataFrame or bigframes.series.Series or pandas.core.frame.DataFrame or pandas.core.series.Series) – The DataFrame or Series with training data.
- Returns:
Fitted encoder.
- Return type:
- transform(y: DataFrame | Series | DataFrame | Series) DataFrame[source]#
Transform y using label encoding.
- Parameters:
y (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:
The result is an array-like of values.
- Return type: