invenia / FeatureTransforms.jl

Transformations for performing feature engineering in machine learning applications
MIT License
37 stars 1 forks source link

Custom Transform #9

Open glennmoy opened 3 years ago

glennmoy commented 3 years ago

As mentioned in #5 and #6, a CustomTransform (or some other name) would be useful when one wants to apply some custom function to their data.

This would be quite useful since we then wouldn't have to write a new Transform for each of these.

TODO: MWE

nicoleepp commented 3 years ago

Something like

"""
    CustomTransform <: Transform

Apply the function passed in to CustomTransform as the transform.
"""
struct CustomTransform <: Transform
    transform_function::Function
    args
end

function _apply!(x::AbstractArray, CT::CustomTransform; kwargs...)
    return CT.transform_function(x, ct.args...; kwargs...)
end