Generates Parsing Spec for TensorFlow Example to be Used with Regressors
If users keep data in tf$Example
format, they need to call tf$parse_example
with a proper feature spec. There are two main things that this utility
helps:
Users need to combine parsing spec of features with labels and weights (if any) since they are all parsed from same
tf$Example
instance. This utility combines these specs.It is difficult to map expected label by a regressor such as
dnn_regressor
to correspondingtf$parse_example
spec. This utility encodes it by getting related information from users (key, dtype).
regressor_parse_example_spec(feature_columns, label_key,
label_dtype = tf$float32, label_default = NULL, label_dimension = 1L,
weight_column = NULL)
Arguments
feature_columns | An iterable containing all feature columns. All items
should be instances of classes derived from |
label_key | A string identifying the label. It means |
label_dtype | A |
label_default | used as label if label_key does not exist in given
|
label_dimension | Number of regression targets per example. This is the
size of the last dimension of the labels and logits |
weight_column | A string or a |
Value
A dict mapping each feature key to a FixedLenFeature
or
VarLenFeature
value.
Raises
ValueError: If label is used in
feature_columns
.ValueError: If weight_column is used in
feature_columns
.ValueError: If any of the given
feature_columns
is not a_FeatureColumn
instance.ValueError: If
weight_column
is not a_NumericColumn
instance.ValueError: if label_key is
NULL
.
See also
Other parsing utilities: classifier_parse_example_spec