Returns a bucketized column, with a bucket index assigned to each input.
tft.bucketize_per_key(
x: common_types.ConsistentTensorType,
key: common_types.TensorType,
num_buckets: int,
epsilon: Optional[float] = None,
name: Optional[str] = None
) -> common_types.ConsistentTensorType
Args |
x
|
A numeric input Tensor or SparseTensor with rank 1, whose values
should be mapped to buckets. SparseTensor s will have their non-missing
values mapped and missing values left as missing.
|
key
|
A Tensor or SparseTensor with the same shape as x and dtype
tf.string. If x is a SparseTensor , key must exactly match x in
everything except values, i.e. indices and dense_shape must be identical.
|
num_buckets
|
Values in the input x are divided into approximately
equal-sized buckets, where the number of buckets is num_buckets.
|
epsilon
|
(Optional) see bucketize
|
name
|
(Optional) A name for this operation.
|
Returns |
A 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). If the computed
key vocabulary doesn't have an entry for key then the resulting bucket is
-1.
|
Raises |
ValueError
|
If value of num_buckets is not > 1.
|