You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
inplace: should transform be applied inplace or create a new column
out_column: name of column to create if inplace=False
transform_func: function that takes wide dataframe with selected in_column and transforms it so the shape and columns remains the same. It can be
some function on dataframe itself
calling apply with any user-defined function in lambda
type: Callable[[pd.DataFrame], pd.DataFrame]
inverse_transform_func: is necessary if inplace=True, signature is the same as signature of transform_func
Reference transforms (multi-segment):
LagTransform
AddConstTransform
LogTransform
After creation of this transform some existing transforms can be rewritten using it. We can inherit them from LambdaTransform and set transform_func, inverse_transform_func to some methods of the class.
LagTransform -- add some checks during the init an
AddConstTransform
LogTransform -- add some checks during the transform
Test cases
Make sure that rewritten transforms pass the tests.
Test that if inplace=Trueinverse_transform_func is necessary.
Test interface if inplace=True.
Test interface if inplace=False: column name should be generated by out_column if it is present.
Test transform method for some function examples.
Test inverse_transform for some function examples in inplace=True and inplace=False.
Alternatives
No response
Additional context
No response
Checklist
I discussed this issue with ETNA Team
The text was updated successfully, but these errors were encountered:
🚀 Feature Request
The idea is to create a transform with custom transformation/inverse transformation.
Motivation
It can help users to write less boilerplate code for custom transforms.
Proposal
Constructor parameters:
in_column
: name of column to transforminplace
: should transform be applied inplace or create a new columnout_column
: name of column to create ifinplace=False
transform_func
: function that takes wide dataframe with selectedin_column
and transforms it so the shape and columns remains the same. It can beapply
with any user-defined function in lambdaCallable[[pd.DataFrame], pd.DataFrame]
inverse_transform_func
: is necessary ifinplace=True
, signature is the same as signature oftransform_func
Reference transforms (multi-segment):
LagTransform
AddConstTransform
LogTransform
After creation of this transform some existing transforms can be rewritten using it. We can inherit them from
LambdaTransform
and settransform_func
,inverse_transform_func
to some methods of the class.LagTransform
-- add some checks during the init anAddConstTransform
LogTransform
-- add some checks during the transformTest cases
inplace=True
inverse_transform_func
is necessary.inplace=True
.inplace=False
: column name should be generated byout_column
if it is present.transform
method for some function examples.inverse_transform
for some function examples ininplace=True
andinplace=False
.Alternatives
No response
Additional context
No response
Checklist
The text was updated successfully, but these errors were encountered: