我只是使用 Tensorflow 及其 tf.learn api 来创建和训练 DNNRegressor 模型。我有一个多价的整数特征列(每一行在该列中可以有多个整数值),并且我对此特征列使用 tf.contrib.layers.sparse_column_with_integerized_feature 。
现在我的问题是如何分隔 csv 文件中该列中的整数。我使用 ',' 但出现此错误:
'Value passed to parameter 'x' has DataType string not in list of allowed
values: int32, int64, float32, float64'.
这是创建稀疏特征列的代码行:
userWatchIds = tf.contrib.layers.sparse_column_with_integerized_feature("userWatchIds", combiner='mean', bucket_size=166000)
userWatchIds 是 csv 文件中多价整数列的名称]
非常感谢您的帮助
最佳答案
就我而言,像“category1,category2,category3”格式的输入可以直接用作 tf.
关于python - 如何分隔 csv 列中的值以用作 tf.contrib.learn.DNNRegressor 中的稀疏列_with_integerized_feature 中的多价特征列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44394133/