TensorFlow VocabularyProcessor的替代方案是什么?

5

它说这个功能已经过时,将来会被移除。另外一行提示“请使用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个回答

3
我也还没有解决这个问题。 以下是一组解释:

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)

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接