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]

__init__(com=None, span=None, halflife=None, alpha=None, ignore_na=False)[source]#

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_of

base_of_exclude

commutative

default_value

Default value this feature returns if no data found.

description_template

input_types

woodwork.ColumnSchema types of inputs

max_stack_depth

name

Name of the primitive

number_output_features

Number of columns in feature matrix associated with this feature

return_type

ColumnSchema type of return

stack_on

stack_on_exclude

stack_on_self

uses_calc_time

uses_full_dataframe