Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def ratio_value_number_to_time_series_length(self, x):
"""
As in tsfresh `ratio_value_number_to_time_series_length `_
Returns a factor which is 1 if all values in the time series occur only once,
and below one if this is not the case.
In principle, it just returns: # unique values / # values
:param x: the time series to calculate the feature of
:type x: pandas.Series
:return: the value of this feature
:rtype: float
"""
ratio = feature_calculators.ratio_value_number_to_time_series_length(x)
logging.debug("ratio value number to time series length by tsfresh calculated")
return ratio
def time_series_ratio_value_number_to_time_series_length(x):
"""
Returns a factor which is 1 if all values in the time series occur only once,
and below one if this is not the case.
In principle, it just returns
# unique values / # values
:param x: the time series to calculate the feature of
:type x: pandas.Series
:return: the value of this feature
:return type: float
"""
return ts_feature_calculators.ratio_value_number_to_time_series_length(x)
def get_function(self):
return ratio_value_number_to_time_series_length