get_asc_insert_func

Function

Obtains the data preprocessing function.

Prototype

1
def get_asc_insert_func(tgt_key_specs=None, args_index_list=None, table_names=None, **kwargs)

Parameters

Parameter

Type

Mandatory/Optional

Description

tgt_key_specs

  • FeatureSpec
  • list[FeatureSpec]

Mandatory. Parameters can be passed in two modes.

Feature object, feature object list, or feature object tuple. The default value is None.

args_index_list

list[int]

List of parameter indexes. The default value is None. The value range is[1, 2^31 – 1].

table_names

list[str]

List of table names. The default value is None. The value range is[1, 2^31 – 1].

The parameters can be passed in either of the following modes:

  • Pass only tgt_key_specs.
  • Pass both args_index_list and table_names.

**kwargs Parameters

Parameter

Type

Mandatory/Optional

Description

is_training

bool

Optional

Whether to enable the training mode. The default value is True.

Value:

  • True: training mode
  • False: evaluation or prediction mode

dump_graph

bool

Optional

Whether to save the model graph. The default value is False.

Value:

  • True: model graph saved
  • False: model graph not saved
  • is_training and dump_graph of **kwargs are for internal use. You are not advised to pass these two parameters through kwargs.
  • If kwargs is used to pass other parameters that are not described, Rec SDK does not use these parameters.

Return Value

  • Success: data preprocessing function.
  • Failure: An exception is thrown.

Example

1
2
3
4
5
import tensorflow as tf
from mx_rec.core.asc.helper import get_asc_insert_func

dataset = tf.data.TFRecordDataset(data_path) # data_path indicates the dataset path.
dataset = dataset.map(get_asc_insert_func(tgt_key_specs=feature_spec_list, is_training=True)) # Elements in feature_spec_list are FeatureSpec objects.

See Also

For details about the API call sequence and example, see Porting and Training.