Defining a cross_column for dependent categorical features

Defining a cross_column for dependent categorical features



My features include two columns:


department


service



Because department and service are mostly "sparse" columns, they were defined as:


department


service


department_column = tf.feature_column.categorical_column_with_hash_bucket("department", 200, dtype=tf.int32)
feature_dict["department"] = tf.feature_column.indicator_column(department_column)

service_column = tf.feature_column.categorical_column_with_hash_bucket("service", 4000, dtype=tf.int32)
feature_dict["service"] = tf.feature_column.indicator_column(service_column)



But when we define this features as independent columns we're not describing the relation between this columns: service only makes sense only in the scope of particular department.


service


department



To describe the relation, it seems a good idea to use crossed columns.



The solution consist of two stages:


crossed_column


crossed_column


embedding_column


indicator_column









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.