简体   繁体   English

TensorFlow文本分类示例-如何评估自己的文本?

[英]TensorFlow example for text classification - how to evaluate your own text?

Does any one have full steps and example for TensorFlow example for passing in your own text files and getting them evaluated against the existing model that comes with examples - using train.py as documented? 是否有人拥有TensorFlow示例的完整步骤和示例,以传递您自己的文本文件并根据示例附带的现有模型对它们进行评估-使用所记录的train.py

Also, if I wanted to train on different input set of say 1000 text files of my own samples, and then use that model for new text files? 另外,如果我想训练自己样本的1000个文本文件的不同输入集,然后将该模型用于新的文本文件? I know there is documentation but is terse for someone who is not familiar with text classification process. 我知道有文档,但是对于不熟悉文本分类过程的人来说很简短。

I was able to run image example against my own images as that was only requiring to swap out one image .jpg file name for myh new image file, but for text it seems to be more involved. 我能够针对自己的图像运行图像示例,因为这仅需要将一个图像.jpg文件名换成myh新图像文件,而对于文本,它似乎涉及更多。

Thanks 谢谢

Here is an example: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/skflow/text_classification.py 这是一个例子: https : //github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/skflow/text_classification.py

You can set the flag test_with_fake_data to use the fake data in text_train.csv (training samples) and text_test.csv (testing samples) here . 您可以设置标志test_with_fake_data在text_train.csv(训练样本)和text_test.csv(测试样品)使用伪造的数据在这里 Next, you can modify these two files to include whatever data you'd like to have. 接下来,您可以修改这两个文件以包含您想要的任何数据。 You will need to do some preprocessing if your existing text files are in a different format. 如果您现有的文本文件采用其他格式,则需要进行一些预处理。

You need to load the vocabulary file saved during training and process your new text with that. 您需要加载在培训期间保存的词汇文件,并以此来处理新文本。 See the eval.py file here 这里查看eval.py文件

Change the data parameters with your input text and proceed. 使用输入文本更改数据参数,然后继续。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM