Skip to content
Open
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
18 changes: 9 additions & 9 deletions feature_engine/encoding/rare_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,22 @@ class RareLabelEncoder(CategoricalMethodsMixin, CategoricalInitMixinNA):

Parameters
----------
tol: float, default=0.05
tol : float, default=0.05
The minimum frequency a label should have to be considered frequent.
Categories with frequencies lower than tol will be grouped.

n_categories: int, default=10
n_categories : int, default=10
The minimum number of categories a variable should have for the encoder
to find frequent labels. If the variable contains less categories, all
of them will be considered frequent.

max_n_categories: int, default=None
max_n_categories : int, default=None
The maximum number of categories that should be considered frequent.
If None, all categories with frequency above the tolerance (tol) will be
considered frequent. If you enter 5, only the 5 most frequent categories will
be retained and the rest grouped.

replace_with: string, integer or float, default='Rare'
replace_with : string, integer or float, default='Rare'
The value that will be used to replace infrequent categories.

{variables}
Expand All @@ -102,7 +102,7 @@ class RareLabelEncoder(CategoricalMethodsMixin, CategoricalInitMixinNA):

Attributes
----------
encoder_dict_:
encoder_dict_ :
Dictionary with the frequent categories, i.e., those that will be kept, per
variable.

Expand Down Expand Up @@ -215,11 +215,11 @@ def fit(self, X: IntoDataFrame, y: Optional[IntoSeries] = None):

Parameters
----------
X: dataframe of shape = [n_samples, n_features]
X : dataframe of shape = [n_samples, n_features]
The training input samples. Can be the entire dataframe, not just selected
variables

y: None
y : None
y is not required. You can pass y or None.
"""

Expand Down Expand Up @@ -274,12 +274,12 @@ def transform(self, X: IntoDataFrame) -> IntoDataFrame:

Parameters
----------
X: dataframe of shape = [n_samples, n_features]
X : dataframe of shape = [n_samples, n_features]
The input samples.

Returns
-------
X: dataframe of shape = [n_samples, n_features]
X : dataframe of shape = [n_samples, n_features]
The dataframe where rare categories have been grouped.
"""

Expand Down