alteryx / featuretools

An open source python library for automated feature engineering
https://www.featuretools.com
BSD 3-Clause "New" or "Revised" License
7.25k stars 879 forks source link

Add common log transform primitive #2392

Open ozzieD opened 1 year ago

ozzieD commented 1 year ago

Log transforms can often be helpful for heavily skewed numeric data.

Code Example

class Logarithm(TransformPrimitive):
    """Computes the logarithm of base 10 of a number.
    """

    name = "logarithm"
    input_types = [ColumnSchema(semantic_tags={"numeric"})]
    return_type = ColumnSchema(logical_type=Double, semantic_tags={"numeric"})
    compatibility = [Library.PANDAS, Library.DASK, Library.SPARK]
    description_template = "the logarithm of {}"

    def get_function(self):
        return np.log10
thehomebrewnerd commented 1 year ago

Should we make this even more generic to compute the log of base n, where n defaults to 10, but could be configured by the user?

ozzieD commented 1 year ago

Yeah, I like that more.