什么是TensorFlow VocabularyProcessor的替代品?

时间:2018-04-14 11:17:24

标签: 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)

1 个答案:

答案 0 :(得分:2)

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

  

tf.contrib.learn.preprocessing:已过时。仅限python   预处理功能不适用于TensorFlow。请用   tf.data,并针对更复杂的用例考虑使用tensorflow / transform。

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)