featuretools.primitives.ExponentialWeightedAverage#
- class featuretools.primitives.ExponentialWeightedAverage(com=None, span=None, halflife=None, alpha=None, ignore_na=False)[source]#
计算一系列数字的指数加权移动平均值
- Description:
返回一系列数字的指数加权移动平均值.必须提供中心质量(com)、跨度(span)、半衰期(half-life)和 平滑因子(alpha)中的一个.通过将’ignore_na’设置为True,可以在计算权重时忽略缺失值.
- Parameters:
com (float) – 以中心质量指定衰减,要求 com >= 0. 默认值为 None.
span (float) – 以跨度指定衰减,要求 span >= 1. 默认值为 None.
halflife (float) – 以半衰期指定衰减,要求 halflife > 0. 默认值为 None.
alpha (float) – 直接指定平滑因子 alpha.alpha 应大于 0 且小于或等于 1. 默认值为 None.
ignore_na (bool) – 在计算权重时忽略缺失值. 默认值为 False.
Examples
>>> exponential_weighted_average = ExponentialWeightedAverage(com=0.5) >>> exponential_weighted_average([1, 2, 3, 4]).tolist() [1.0, 1.75, 2.615384615384615, 3.55]
可以忽略缺失值 >>> ewma_ignorena = ExponentialWeightedAverage(com=0.5, ignore_na=True) >>> ewma_ignorena([1, 2, 3, None, 4]).tolist() [1.0, 1.75, 2.615384615384615, 2.615384615384615, 3.55]
Methods
__init__([com, span, halflife, alpha, ignore_na])flatten_nested_input_types(input_types)将嵌套的列模式输入展平成一个列表.
generate_name(base_feature_names)generate_names(base_feature_names)get_args_string()get_arguments()get_description(input_column_descriptions[, ...])get_filepath(filename)get_function()Attributes
base_ofbase_of_excludecommutativedefault_valueDefault value this feature returns if no data found.
description_templateinput_typeswoodwork.ColumnSchema types of inputs
max_stack_depthnameName of the primitive
number_output_featuresNumber of columns in feature matrix associated with this feature
return_typeColumnSchema type of return
stack_onstack_on_excludestack_on_selfuses_calc_timeuses_full_dataframe