featuretools.primitives.ExponentialWeightedAverage#

class featuretools.primitives.ExponentialWeightedAverage(com=None, span=None, halflife=None, alpha=None, ignore_na=False)[源码]#

计算一个数列的指数加权移动平均

描述

返回一个数列的指数加权移动平均。必须提供中心质量 (com)、跨度 (span)、半衰期 (halflife) 和 alpha 中的 *且仅* 一个。通过将 ‘ignore_na’ 设置为 True,可以在计算权重时忽略缺失值。

参数:
  • 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。

示例

>>> 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)[源码]#

方法

__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()

属性

base_of

base_of_exclude

commutative

default_value

如果未找到数据,此特征返回的默认值。

description_template

input_types

输入的 woodwork.ColumnSchema 类型

max_stack_depth

name

原语名称

number_output_features

与此特征相关的特征矩阵中的列数

return_type

返回的 ColumnSchema 类型

stack_on

stack_on_exclude

stack_on_self

uses_calc_time

uses_full_dataframe