tf.compat.v1.feature_column.make_parse_example_spec
Stay organized with collections
Save and categorize content based on your preferences.
Creates parsing spec dictionary from input feature_columns. (deprecated)
tf . compat . v1 . feature_column . make_parse_example_spec (
feature_columns
)
Deprecated: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use Keras preprocessing layers instead, either directly or via the tf.keras.utils.FeatureSpace
utility. Each of tf.feature_column.*
has a functional equivalent in tf.keras.layers
for feature preprocessing when training a Keras model.
The returned dictionary can be used as arg 'features' in
tf.io.parse_example
.
Typical usage example:
# Define features and transformations
feature_a = categorical_column_with_vocabulary_file ( ... )
feature_b = numeric_column ( ... )
feature_c_bucketized = bucketized_column ( numeric_column ( "feature_c "), ... )
feature_a_x_feature_c = crossed_column (
columns = [ "feature_a ", feature_c_bucketized ], ... )
feature_columns = set (
[ feature_b , feature_c_bucketized , feature_a_x_feature_c ])
features = tf . io . parse_example (
serialized = serialized_examples ,
features = make_parse_example_spec ( feature_columns ))
For the above example, make_parse_example_spec would return the dict:
{
"feature_a ": parsing_ops . VarLenFeature ( tf . string ),
"feature_b ": parsing_ops . FixedLenFeature ([ 1 ], dtype = tf . float32 ),
"feature_c ": parsing_ops . FixedLenFeature ([ 1 ], dtype = tf . float32 )
}
Args
feature_columns
An iterable containing all feature columns. All items
should be instances of classes derived from _FeatureColumn
.
Returns
A dict mapping each feature key to a FixedLenFeature
or VarLenFeature
value.
Raises
ValueError
If any of the given feature_columns
is not a _FeatureColumn
instance.
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. Some content is licensed under the numpy license .
Last updated 2024-01-23 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-01-23 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-01-23 UTC."]]