View source on GitHub |
Returns a function that generates sliced record batches for a given one.
tfdv.experimental_get_feature_value_slicer(
features: Dict[types.FeatureName, Optional[_ValueType]]
) -> types.SliceFunction
The returned function returns sliced record batches based on the combination
of all features specified in features
. To slice on features separately (
e.g., slice on age feature and separately slice on interests feature), you
must use separate slice functions.
Examples:
Slice on each value of the specified features.
slice_fn = get_feature_value_slicer( features={'age': None, 'interests': None})
Slice on a specified feature value.
slice_fn = get_feature_value_slicer(features={'interests': ['dogs']})
Slice on each value of one feature and a specified value of another.
slice_fn = get_feature_value_slicer( features={'fruits': None, 'numbers': [1]})
Returns | |
---|---|
A function that takes as input a single record batch and returns a list of sliced record batches (slice_key, record_batch). |
Raises | |
---|---|
TypeError
|
If feature values are not specified in an iterable. |
NotImplementedError
|
If a value of a type other than string or integer is
specified in the values iterable in features .
|