In tsfresh we differentiate between two types of feature calculation methods

1. simple

2. combiner

The difference lays in the number of calculated features for a singular time series.
The feature_calculator returns either one (1.) or multiple features (2.).
So if you want to add a singular feature stick with 1., the simple feature calculator class.
If it is beneficial to calculate multiples features at the same time (to e.g. perform auxiliary calculations only once
for all features), stick with type 2..

Depending on which type of feature you are implementing, you can use the following feature calculator skeletons:

1. simple features

You can write such a simple feature calculator, that returns exactly one feature, without parameter

@set_property("fctype","simple")defyour_feature_calculator(x):""" The description of your feature :param x: the time series to calculate the feature of :type x: pandas.Series :return: the value of this feature :return type: bool, int or float """# Calculation of feature as float, int or boolf=f(x)returnf

@set_property("fctype","combiner")defyour_feature_calculator(x,param):""" Description of your feature :param x: the time series to calculate the feature of :type x: pandas.Series :param c: the time series name :type c: str :param param: contains dictionaries {"p1": x, "p2": y, ...} with p1 float, p2 int ... :type param: list :return: list of tuples (s, f) where s are the parameters, serialized as a string, and f the respective feature value as bool, int or float :return type: pandas.Series """# s is a function that serializes the config# f is a function that calculates the feature value for the configreturn[(s(config),f(x,config))forconfiginparam]

We would very happy if you contribute your implemented features to tsfresh. So make sure to create a pull request at our
github page. We happily accept partly implemented feature calculators, which
we can finalize collaboratively.