特征淘汰Hook类,仅在特征准入与淘汰模式下使用,配合特征淘汰的阈值“eviction_threshold”设置,添加后即可开启特征淘汰功能。
特征淘汰Hook类仅支持在训练场景下使用。
参数名 |
类型 |
必选/可选 |
说明 |
---|---|---|---|
evict_enable |
bool |
可选 |
是否开启特征淘汰功能,默认为“False”。 |
evict_time_interval |
int |
可选 |
淘汰功能触发时间间隔,单位:秒,默认为24 * 60 * 60。取值范围:[1, MAXINT32]。 |
evict_step_interval |
int |
可选 |
淘汰功能触发步数间隔,单位:步,默认为None。取值范围:[1, MAXINT32]。 |
1 2 3 4 5 6 7 8 9 10 | 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对象 |