python - 如何分隔 csv 列中的值以用作 tf.contrib.learn.DNNRegressor 中的稀疏列_with_integerized_feature 中的多价特征列

标签 python machine-learning tensorflow deep-learning keras

我只是使用 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/

相关文章:

python - pycharm 和终端中的 sklearn "numpy.dtype has the wrong size, try recompiling"

python - 面向专家的 TensorFlow MNIST 预测

tensorflow - 在tensorflow中加载图像文件夹

python - 当脚本在更大的数据集上运行时,LSTM 自动编码器没有进展

machine-learning - 如何在OpenAI中创建新的健身房环境?

machine-learning - 如何使预先存在的 tensorflow variable_scope应用于操作?

python - 如何向量化分类数据

python - 如何从文本中找到正面和负面单词的总数?

python - Django 相当于 Rails 的 x.days.from_now

python - Normal equation 和 Numpy 'least-squares' , 'solve' 回归方法的区别?