Construct a Crossed Column

Returns a column for performing crosses of categorical features. Crossed features will be hashed according to hash_bucket_size.

column_crossed(keys, hash_bucket_size, hash_key = NULL)

Arguments

keys

An iterable identifying the features to be crossed. Each element can be either:

  • string: Will use the corresponding feature which must be of string type.

  • categorical column: Will use the transformed tensor produced by this column. Does not support hashed categorical columns.

hash_bucket_size

The number of buckets (> 1).

hash_key

Optional: specify the hash_key that will be used by the FingerprintCat64 function to combine the crosses fingerprints on SparseCrossOp.

Value

A crossed column.

Raises

  • ValueError: If len(keys) < 2.

  • ValueError: If any of the keys is neither a string nor categorical column.

  • ValueError: If any of the keys is _HashedCategoricalColumn.

  • ValueError: If hash_bucket_size < 1.

See also

Other feature column constructors: column_bucketized, column_categorical_weighted, column_categorical_with_hash_bucket, column_categorical_with_identity, column_categorical_with_vocabulary_file, column_categorical_with_vocabulary_list, column_embedding, column_numeric, input_layer