def get_placeholder_input_fn(metadata):
"""Wrap the get input features function to provide the metadata."""
def get_input_features():
"""Read the input features from the given placeholder."""
examples = tf.placeholder(
dtype=tf.string,
shape=(None,),
name='input_example')
features = ml.features.FeatureMetadata.parse_features(metadata, examples,
keep_target=False)
features[EXAMPLES_PLACEHOLDER_KEY] = examples
# The target feature column is not used for prediction so return None.
return features, None
# Return a function to input the feaures into the model from a placeholder.
return get_input_features
评论列表
文章目录