Tensorflow Estimator API具有大量功能

时间:2018-01-21 17:58:58

标签: python tensorflow

我正在使用Tensorflow Estimator API来训练一些模型,但是发现我必须为每个功能使用tf.feature_column

我的数据集由以下列组成:

  

[' age',' workclass',' education',' education_num',' marital_status',          '职业','关系','种族','性别',' capital_gain',          ' capital_loss',' hours_per_week',' native_country',' income_bracket']

为什么我必须像这样做

gender = tf.feature_column.categorical_column_with_hash_bucket("gender", hash_bucket_size=10)
occupation = tf.feature_column.categorical_column_with_hash_bucket("occupation", hash_bucket_size=1000)
marital_status = tf.feature_column.categorical_column_with_hash_bucket("marital_status", hash_bucket_size=1000)
relationship = tf.feature_column.categorical_column_with_hash_bucket("relationship", hash_bucket_size=1000)
education = tf.feature_column.categorical_column_with_hash_bucket("education", hash_bucket_size=1000)
workclass = tf.feature_column.categorical_column_with_hash_bucket("workclass", hash_bucket_size=1000)
native_country = tf.feature_column.categorical_column_with_hash_bucket("native_country", hash_bucket_size=1000)

..等,似乎不是处理功能预处理的最佳方式。有没有更好的方法,或者如果我们去tf.estimator

,我们将会陷入这种痛苦之中

0 个答案:

没有答案