python - TensorFlow VocabularyProcessor 的替代方案是什么?

标签 python tensorflow machine-learning

它说它已被弃用,将来会被删除。另一行说“请使用 tensorflow/transform 或 tf.data”。我搜索了互联网,但找不到答案。这是给我警告的行:

# Change texts into numeric vectors
vocab_processor = tf.contrib.learn.preprocessing.VocabularyProcessor(max_sequence_length,min_frequency=min_word_frequency)

最佳答案

我也没有解决。 一组解释在这里:

tf.contrib.learn.preprocessing: Deprecated. The python-only preprocessing functions are not a good fit for TensorFlow. Please use tf.data, and consider tensorflow/transform for more complex use cases.

https://github.com/tensorflow/tensorflow/blob/r1.8/tensorflow/contrib/learn/README.md

这个例子应该有所帮助......但它并没有解释太多 https://github.com/tensorflow/transform/blob/master/examples/sentiment_example.py

review_indices = tft.compute_and_apply_vocabulary(
                    review_tokens, top_k=VOCAB_SIZE)

关于python - TensorFlow VocabularyProcessor 的替代方案是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49830843/

相关文章:

python - Django 中的非主外键

tensorflow - 对象不支持 tensorflow 中的项目分配

python - 在 tensorflow 中对相似的值进行分组

python - 使用轮廓分数

WEKA J48 类的 C# 或 .NET 实现?

apache-spark - 推荐系统在生产中如何工作?

python - 使用函数 1 的输出作为函数 2 的输入

python - 如何解析下面的 .txt 文件?

python - 调用不带括号的函数python的目的

machine-learning - TensorFlow:在另一个 LSTM 之上的 LSTM