featuretools.primitives.ExponentialWeightedVariance#
- class featuretools.primitives.ExponentialWeightedVariance(com=None, span=None, halflife=None, alpha=None, ignore_na=False)[源代码]#
计算一系列数字的指数加权移动方差
- 描述
返回一系列数字的指数加权移动方差。必须且只能提供中心质量 (com)、跨度 (span)、半衰期 (halflife) 和 alpha 中的一个。通过设置 ‘ignore_na’ 为 True 可以在计算权重时忽略缺失值。
- 参数:
com (float) – 指定大于等于 0 的中心质量 (com) 衰减。默认为 None。
span (float) – 指定大于等于 1 的跨度 (span) 衰减。默认为 None。
halflife (float) – 指定大于 0 的半衰期 (halflife) 衰减。默认为 None。
alpha (float) – 直接指定平滑因子 alpha。Alpha 应大于 0 且小于等于 1。默认为 None。
ignore_na (bool) – 在计算权重时忽略缺失值。默认为 False。
示例
>>> 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]
方法
__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