Skip to content

Latest commit

 

History

History
121 lines (70 loc) · 3.25 KB

TimestampRestrictPolicy.md

File metadata and controls

121 lines (70 loc) · 3.25 KB

tfra.dynamic_embedding.TimestampRestrictPolicy

View source on GitHub




Class TimestampRestrictPolicy

A derived policy to eliminate features in variable follow the

Inherits From: RestrictPolicy

oldest-out-first rule.

__init__

View source

__init__(var)

A timestamp status sparse variable is created. The timestamp status has same key_dtype as the target variable and value_dtype in int32, which indicates the timestamp value. The timestamp means a digital record of time. The later the time, the larger the timestamp.

Args:

Properties

status

Get status variable which save information about properties of features.

Methods

apply_restriction

View source

apply_restriction(
    num_reserved,
    **kwargs
)

Define the rule to restrict the size of the target variable by eliminating the oldest k features, and number of num_reserved feature will be kept.

Args:

  • num_reserved: int. Number of remained keys after restriction.
  • **kwargs: (Optional) reserved keyword arguments. trigger: int. The triggered threshold to execute restriction. Default equals to num_reserved.

Returns:

An operation to restrict the sizes of variable and variables in slots.

apply_update

View source

apply_update(ids)

Define the rule to update the timestamp status. If any feature shows up in training, then its timestamp will be updated.

Args:

  • ids: A Tensor. Keys appear in training. These keys in status variable will be updated if needed.

Returns:

An operation to update timestamp status.