EvictHook

特征淘汰Hook类,仅在特征准入与淘汰模式下使用,配合特征淘汰的阈值“eviction_threshold”设置,添加后即可开启特征淘汰功能。

特征淘汰Hook类仅支持在训练场景下使用。

参数名

参数类型

参数说明

必选/可选

evict_enable

bool

是否开启特征淘汰功能,默认为“False”

可选

evict_time_interval

int

淘汰功能触发时间间隔,单位:秒,默认为24 * 60 * 60。取值范围:[1, MAXINT32]。

可选

evict_step_interval

int

淘汰功能触发步数间隔,单位:步,默认为None。取值范围:[1, MAXINT32]。

可选

使用示例

from mx_rec.core.feature_process import EvictHook
hooks_list = []
hook_evict = EvictHook(evict_enable=True, evict_time_interval=30, evict_step_interval=20)
hooks_list.append(hook_evict)

#定义数据处理函数
def input_fn():
     pass

est.train(input_fn=lambda: input_fn(), hooks=hooks_list)    #est为创建的NPUEstimator对象