Skip to content

featurebyte.ValueBeyondEndpointImputation

class ValueBeyondEndpointImputation(
*,
imputed_value: Union[bool, int, float, str, NoneType],
type: Literal["less_than", "less_than_or_equal", "greater_than", "greater_than_or_equal"],
end_point: Union[bool, int, float, str]
)

Description

ValueBeyondEndpointImputation class is used to declare the operation to impute the value when the value in the column exceeds a specified endpoint type.

If the imputed_value parameter is None, the values to impute are replaced by missing values and the corresponding rows are ignored during aggregation operations.

Parameters

  • imputed_value: Union[bool, int, float, str, NoneType]
    The value that will be used to replace any value that falls outside a specified range.

  • type: Literal["less_than", "less_than_or_equal", "greater_than", "greater_than_or_equal"]
    Determines how the boundary values are treated.
    - If type is less_than, any value that is less than the end_point value will be replaced with imputed_value.
    - If type is less_than_or_equal, any value that is less than or equal to the end_point value will be replaced with imputed_value.
    - If type is greater_than, any value that is greater than the end_point value will be replaced with imputed_value.
    - If type is greater_than_or_equal, any value that is greater than or equal to the end_point value will be replaced with imputed_value.

  • end_point: Union[bool, int, float, str]
    The value that marks the boundary.

Examples

Create an imputation rule to replace value less than 0 to 0.

>>> fb.ValueBeyondEndpointImputation(
...     type="less_than", end_point=0, imputed_value=0
... )  # doctest: +SKIP

Create an imputation rule to ignore value higher than 1M.

>>> fb.ValueBeyondEndpointImputation(type="less_than", end_point=1e6, imputed_value=None)
ValueBeyondEndpointImputation(imputed_value=None, type=less_than, end_point=1000000.0)