FeatureSpec

待查询特征的配置描述类,适用于非自动改图模式。

参数名

类型

必选/可选

说明

index_key

int/string

可选

索引键。

默认值:table_name的值

取值范围:

  • int:取值范围[0,255]
  • string:长度范围[1,255]

table_name

string

可选

表名。

默认值:无

表名长度范围:[1, 255]

access_threshold

int

可选

特征准入阈值。

默认值:none

取值范围:[-1, 2147483647]

  • 等于“0”:开启准入功能。不累加新batch中key出现的次数,使用历史特征计数记录。
  • 大于“0”:开启准入功能。累加新batch中key出现的次数,更新特征计数记录。
  • 等于“-1”:关闭功能。

eviction_threshold

int

可选

特征淘汰阈值。

默认值:none

取值范围:[-1, 2147483647]

  • 等于或大于“0”:开启淘汰功能。
  • 等于“-1”:关闭淘汰功能。

如果需要设置特征淘汰阈值,需要同时设置特征准入阈值。

is_timestamp

bool

可选

是否为时间戳。

默认值:none

取值范围:

  • True
  • False

batch_size

int

可选

数据集batch的大小。

默认值:none

取值范围:[1, 2147483647]

faae_coefficient

int

可选

特征准入系数。

默认值:1

取值范围:[1, 2147483647]

name

string

必选

FeatureSpec名称。

默认值:无

长度范围[1,255]

使用示例

1
2
3
4
5
from mx_rec.core.asc.feature_spec import FeatureSpec
feature_spec_list = FeatureSpec("user_ids", table_name="user_table",
                                access_threshold=1,
                                eviction_threshold=1,
                                faae_coefficient=1)