EvictHook

Hook class for feature eviction, which is used only in feature access and eviction mode. This class is used together with eviction_threshold to enable the feature eviction function.

The feature eviction hook class is used only in training scenarios.

Parameter

Data Type

Mandatory/Optional

Description

evict_enable

bool

Optional

Whether to enable the feature eviction function. The default value is False.

evict_time_interval

int

Optional

Interval for triggering the feature eviction function, in seconds. The default value is 24 × 60 × 60. Value range: [1, MAXINT32].

evict_step_interval

int

Optional

Step interval for triggering the feature eviction function. The unit is step. The default value is None. Value range: [1, MAXINT32].

Example

 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)

# Define the data processing function.
def input_fn():
     pass

est.train(input_fn=lambda: input_fn(), hooks=hooks_list)    # est is the created NPUEstimator object.