tfdv.experimental_get_feature_value_slicer
Stay organized with collections
Save and categorize content based on your preferences.
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]})
Args |
features
|
A mapping of features to an optional iterable of values that the
returned function will slice on. If values is None for a feature, then the
slice keys will reflect each distinct value found for that feature in the
input record batch. If values are specified for a feature, then the slice
keys will reflect only those values for the feature, if found in the input
record batch. Values must be an iterable of strings or integers.
|
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 .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-04 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-10-04 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-04 UTC."],[],[]]