tft.bucketize_per_key( x, key, num_buckets, epsilon=None, name=None )
Returns a bucketized column, with a bucket index assigned to each input.
x: A numeric input
SparseTensorwith rank 1, whose values should be mapped to buckets.
SparseTensors will have their non-missing values mapped and missing values left as missing.
key: A Tensor or
SparseTensorwith the same shape as
xand dtype tf.string. If
keymust exactly match
xin everything except values, i.e. indices and dense_shape must be identical.
num_buckets: Values in the input
xare divided into approximately equal-sized buckets, where the number of buckets is num_buckets.
epsilon: (Optional) see
name: (Optional) A name for this operation.
Tensor of the same shape as
x, with each element in the
returned tensor representing the bucketized value. Bucketized value is
in the range [0, actual_num_buckets).
ValueError: If value of num_buckets is not > 1.