Skip to content

[Feat]: Log1p transformer  #274

@TremaMiguel

Description

@TremaMiguel

Is your feature request related to a problem? Please describe.

When you want to apply a logarithmic transformation and data contains a zero value, calculating log(1+x) is more convenient.

Describe the solution you'd like

This could be another argument in LogTransformer that checks for zeros and apply log(1 + x)

from feature_engine import transformation as vt

tf = vt.LogTransformer(variables = ['LotArea', 'GrLivArea'], check_zeros=True)

under the hood basically applies

if check_zeros:
    log_1p = True if (X[self.variables_] == 0).any().any() else False

or it can be a separate transformer

from feature_engine import transformation as vt

tf = vt.Log1PTransformer(variables = ['LotArea', 'GrLivArea'], check_zeros=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions