Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save securetorobert/e47b0f0bdcd96bffbdc515c18dbf9b20 to your computer and use it in GitHub Desktop.
Save securetorobert/e47b0f0bdcd96bffbdc515c18dbf9b20 to your computer and use it in GitHub Desktop.
Create a bucketized column from a numeric column
# A numeric column for the raw input.
numeric_feature_column = tf.feature_column.numeric_column("Year")
# Bucketize the numeric column on the years 1960, 1980, and 2000
bucketized_feature_column = tf.feature_column.bucketized_column(
source_column = numeric_feature_column,
boundaries = [1960, 1980, 2000])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment