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.

Attributes

Methods

__init__([min_frequency, max_categories])

fit(y)

Fit label encoder.

fit_transform(y)

get_params([deep])

Get parameters for this estimator.

to_gbq(model_name[, replace])

Save the transformer as a BigQuery model.

transform(y)

Transform y using label encoding.