Skip to content

Instantly share code, notes, and snippets.

@lakshmanok
Created August 13, 2018 16:15
Show Gist options
  • Select an option

  • Save lakshmanok/bc0b79cd2b915eed2c33779050b5d38c to your computer and use it in GitHub Desktop.

Select an option

Save lakshmanok/bc0b79cd2b915eed2c33779050b5d38c to your computer and use it in GitHub Desktop.
How to serve an embedding trained with Estimators
station_embed = tf.feature_column.embedding_column(
tf.feature_column.categorical_column_with_hash_bucket('start_station_id', 5000, tf.int32), 2)
feature_cols = [
tf.feature_column.categorical_column_with_identity('day_of_week', num_buckets = 8),
station_embed,
tf.feature_column.categorical_column_with_vocabulary_list('rainy', ['false', 'true'])
]
estimator = tf.estimator.LinearRegressor(
model_dir = output_dir,
feature_columns = feature_cols)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment