featuretools.primitives.ExponentialWeightedVariance#
- class featuretools.primitives.ExponentialWeightedVariance(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_variance = ExponentialWeightedVariance(com=0.5) >>> exponential_weighted_variance([1, 2, 3, 4]).tolist() [nan, 0.49999999999999983, 0.8461538461538459, 1.1230769230769233]
可以忽略缺失值
>>> ewmv_ignorena = ExponentialWeightedVariance(com=0.5, ignore_na=True) >>> ewmv_ignorena([1, 2, 3, None, 4]).tolist() [nan, 0.49999999999999983, 0.8461538461538459, 0.8461538461538459, 1.1230769230769233]
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