Last active
August 27, 2018 18:47
-
-
Save netskink/23973388bb708ab75922cd587e4194d3 to your computer and use it in GitHub Desktop.
make feature list with list comprehension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INPUT_COLUMNS = [ | |
# Define features | |
tf.feature_column.categorical_column_with_vocabulary_list('dayofweek', vocabulary_list = ['Sun', 'Mon', 'Tues', 'Wed', 'Thu', 'Fri', 'Sat']), | |
tf.feature_column.categorical_column_with_identity('hourofday', num_buckets = 24), | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INPUT_COLUMNS = [ | |
# Numeric Columns | |
tf.feature_column.numeric_column(column) for column in CSV_COLUMNS[2:] | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INPUT_COLUMNS = [ | |
# Define features | |
tf.feature_column.categorical_column_with_vocabulary_list('dayofweek', vocabulary_list = ['Sun', 'Mon', 'Tues', 'Wed', 'Thu', 'Fri', 'Sat']), | |
tf.feature_column.categorical_column_with_identity('hourofday', num_buckets = 24), | |
# Numeric Columns | |
tf.feature_column.numeric_column(column) for column in CSV_COLUMNS[2:] | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INPUT_COLUMNS = [ | |
# Use a list comprehension and concatenation | |
# Define features | |
[ | |
tf.feature_column.categorical_column_with_vocabulary_list('dayofweek', vocabulary_list = ['Sun', 'Mon', 'Tues', 'Wed', 'Thu', 'Fri', 'Sat']), | |
tf.feature_column.categorical_column_with_identity('hourofday', num_buckets = 24) | |
] + | |
# Numeric Columns | |
tf.feature_column.numeric_column(column) for column in CSV_COLUMNS[2:] | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INPUT_COLUMNS_1 = [ | |
# Define features | |
tf.feature_column.categorical_column_with_vocabulary_list('dayofweek', vocabulary_list = ['Sun', 'Mon', 'Tues', 'Wed', 'Thu', 'Fri', 'Sat']), | |
tf.feature_column.categorical_column_with_identity('hourofday', num_buckets = 24) | |
] | |
INPUT_COLUMNS_2 = [ | |
# Numeric Columns | |
tf.feature_column.numeric_column(column) for column in CSV_COLUMNS[2:] | |
] | |
INPUT_COLUMNS = INPUT_COLUMNS_1 + INPUT_COLUMNS_2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment