Which TensorFlow function can you use to configure a categorical column if you don’t know all of the possible values for that column?

Which TensorFlow function can you use to configure a categorical column if you don’t know all of the possible values for that column?
A . categorical_column_with_vocabulary_list
B . categorical_column_with_hash_bucket
C . categorical_column_with_unknown_values
D . sparse_column_with_keys

Answer: B

Explanation:

If you know the set of all possible feature values of a column and there are only a few of them, you can use categorical_column_with_vocabulary_list. Each key in the list will get assigned an auto-incremental ID starting from 0.

What if we don’t know the set of possible values in advance? Not a problem. We can use categorical_column_with_hash_bucket instead.

What will happen is that each possible value in the feature column occupation will be hashed to an integer ID as we encounter them in training.

Reference: https://www.tensorflow.org/tutorials/wide

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments