我是机器学习的新手,我有一个问题,我following this tutorial,我读到了LSTM和RNN。我使用教程提供的代码并运行它,它完成了培训,现在我给了一些测试字符串:
输出是:
Iter= 20000, Average Loss= 0.531466, Average Accuracy= 84.60%
['the', 'sly', 'and'] - [treacherous] vs [treacherous]
Optimization Finished!
Elapsed time: 12.159853319327036 min
Run on command line.
tensorboard --logdir=/tmp/tensorflow/rnn_words
Point your web browser to: http://localhost:6006/
3 words: ,hello wow and
Word not in dictionary
3 words: mouse,mouse,mouse
3 words: mouse
3 words: mouse mouse mouse
mouse mouse mouse very well , but who is to bell the cat approaches the until will at one another and take mouse a receive some signal of her approach , we he easily escape
3 words: 3 words: had a general
had a general to proposal to make round the neck will all agree , said he easily at and enemy approaches to consider what common the case . you will all agree , said he
3 words: mouse mouse mouse
mouse mouse mouse very well , but who is to bell the cat approaches the until will at one another and take mouse a receive some signal of her approach , we he easily escape
3 words: what was cat
what was cat up and said he is all very well , but who is to bell the cat approaches the until will at one another and take mouse a receive some signal of her
3 words: mouse fear cat
Word not in dictionary
3 words: mouse tell cat
Word not in dictionary
mo3 words: mouse said cat
Word not in dictionary
3 words: mouse fear fear
Word not in dictionary
3 words: mouse ring bell
Word not in dictionary
m3 words: mouse ring ring
Word not in dictionary
3 words: mouse bell bell
mouse bell bell and general to make round the neck will all agree , said he easily at and enemy approaches to consider what common the case . you will all agree , said he
3 words: mouse and bell
mouse and bell this means we should always , but looked is young always , but looked is young always , but looked is young always , but looked is young always , but looked
3 words: mouse was bell
mouse was bell and said he is all very well , but who is to bell the cat approaches the until will at one another and take mouse a receive some signal of her approach
3 words:
现在我没有得到什么,当我给出三个单词时,它给出了一些我们可以通过正则表达式或基于规则的代码轻松实现的结果使用if-else,如果在文件中输入单词然后获取一些句子上一句或下一句,这个输出有什么特别之处,它有何不同?请解释
就像有时它说的那样,单词不在dict中,所以如果我只需要提供训练文件中的那些单词那么它就像在训练数据中匹配的单词并从文件中获取一些结果那么我们可以做同样的事情如果没有任何模块,或者在没有任何模块的纯编程中,那么它的不同之处是什么?
答案 0 :(得分:0)
您的训练数据集只有大约180个单词,并且达到了84.6%(训练)的准确度,所以它过度拟合了很多。从本质上讲,该模型只是根据训练数据预测下一个最可能的单词。
通常语言模型是在更大的数据集上训练的,例如PTB或1B字基准。 PTB是一个小数据集,有100,000个单词,1B单词基准有10亿个单词。
RNN模型的词汇量有限,无法对单词或字符进行编码。词汇量大小取决于模型。在PTB上训练的大多数单词模型的词汇量大小为10,000,这对于大多数常见单词来说已经足够了。