easy_rec.python.feature_column

easy_rec.python.feature_column.feature_column

exception easy_rec.python.feature_column.feature_column.FeatureKeyError(feature_name)[source]

Bases: KeyError

__init__(feature_name)[source]
class easy_rec.python.feature_column.feature_column.SharedEmbedding(embedding_name, index, sequence_combiner=None)[source]

Bases: object

__init__(embedding_name, index, sequence_combiner=None)[source]
class easy_rec.python.feature_column.feature_column.FeatureColumnParser(feature_configs, wide_deep_dict={}, wide_output_dim=- 1, use_embedding_variable=False)[source]

Bases: object

Parse and generate feature columns.

__init__(feature_configs, wide_deep_dict={}, wide_output_dim=- 1, use_embedding_variable=False)[source]

Initializes a FeatureColumnParser.

Parameters
  • feature_configs – collections of easy_rec.python.protos.feature_config_pb2.FeatureConfig or easy_rec.python.protos.feature_config_pb2.FeatureConfigV2.features

  • wide_deep_dict – dict of {feature_name:WideOrDeep}, passed by easy_rec.python.layers.input_layer.InputLayer, it is defined in easy_rec.python.protos.easy_rec_model_pb2.EasyRecModel.feature_groups

  • wide_output_dim – output dimension for wide columns

  • use_embedding_variable – use EmbeddingVariable, which is provided by pai-tf

property wide_columns
property deep_columns
property sequence_columns
is_wide(config)[source]
is_deep(config)[source]
parse_id_feature(config)[source]

Generate id feature columns.

if hash_bucket_size or vocab_list or vocab_file is set, then will accept input tensor of string type, otherwise will accept input tensor of integer type.

Parameters

config – instance of easy_rec.python.protos.feature_config_pb2.FeatureConfig

parse_tag_feature(config)[source]

Generate tag feature columns.

if hash_bucket_size is set, will accept input of SparseTensor of string, otherwise num_buckets must be set, will accept input of SparseTensor of integer. tag feature preprocess is done in easy_rec/python/input/input.py: Input. _preprocess

Parameters

config – instance of easy_rec.python.protos.feature_config_pb2.FeatureConfig

parse_raw_feature(config)[source]

Generate raw features columns.

if boundaries is set, will be converted to category_column first.

Parameters

config – instance of easy_rec.python.protos.feature_config_pb2.FeatureConfig

parse_expr_feature(config)[source]

Generate raw features columns.

if boundaries is set, will be converted to category_column first.

Parameters

config – instance of easy_rec.python.protos.feature_config_pb2.FeatureConfig

parse_combo_feature(config)[source]

Generate combo feature columns.

Parameters

config – instance of easy_rec.python.protos.feature_config_pb2.FeatureConfig

parse_lookup_feature(config)[source]

Generate lookup feature columns.

Parameters

config – instance of easy_rec.python.protos.feature_config_pb2.FeatureConfig

parse_sequence_feature(config)[source]

Generate sequence feature columns.

Parameters

config – instance of easy_rec.python.protos.feature_config_pb2.FeatureConfig

easy_rec.python.feature_column.feature_group

class easy_rec.python.feature_column.feature_group.FeatureGroup(feature_group_config)[source]

Bases: object

__init__(feature_group_config)[source]
property group_name
property wide_and_deep_dict
property feature_names
select_columns(fc)[source]