indiejoseph / cnn-text-classification-tf-chinese

CNN for Chinese Text Classification in Tensorflow
235 stars 108 forks source link

你好,请教个问题。能解释下你的代码意思和主要做什么用的,分词? #18

Open jxua opened 7 years ago

jxua commented 7 years ago

你好。不好意思。初学tensorflow,copy了你的代码,在python 3.5.2上train了一下。
image 看了下准确率只有70%,是因为train时间的原因吗,正常要train多久?还有我看了下,这是个英文文章,你的cnn是做分词的 还是什么?请稍微花点时间帮忙解答下 。 然后我想实现,将一个照片上不同部分的defect识别出来,该用什么的tensorflow架构 cnn?有什么架构推荐下

indiejoseph commented 7 years ago

Sentiment classification 是情感分析,即是分煩出文章是正面或是負面, 我用了pre-train的character-level language model, 所以準確度會再高一點(https://github.com/indiejoseph/chinese-char-rnn), 這裡是沒有人手選取特徵和沒有預先分詞,主要是為了演示深度學習在無監督特徵學習相比起傳統NLP的特徵預處理上的優勢。

heloowird commented 7 years ago

看了你的代码,没发现初始化或者加载 pre-train的character-level language model,请问是你怎么使用pre-train的character-level language model的?谢谢

indiejoseph commented 7 years ago

@heloowird 這個版本是沒有實現加載 pre-train language model, 但如想要加,只要把 text_cnn.py 中的 W tf.assign 一個 pre-train numpy array 就就可以。

heloowird commented 7 years ago

所以这里98%的准确率是基于你之前训的char rnn model,而不是随机初始化的?

indiejoseph commented 7 years ago

m3744 commented 7 years ago

想請問一下, 看了參考的論文與chinese-char-rnn的程式,不太理解這個pre-training的資料如何大幅提升預測的準確性,不知你可以大概解說一下或是分享參考的文章或論文,謝謝

indiejoseph commented 7 years ago

@m3744 pre-training 的意思是那些 char embedding, 就如 word2vec,加入到任務一定對預測的準確性有很大幫助

heloowird commented 7 years ago

@m3744 论文在3.2小节第一句提了下: Initializing word vectors with those obtained from an unsupervised neural language model is a popular method to improve performance in the absence of a large supervised training set (Collobert et al., 2011; Socher et al., 2011; Iyyer et al., 2014). 个人觉得pre-training可以得到一些general的文本语义信息,迁移到具体任务(如文本分类)会有一定帮助,类似图像上的finetune思想。以上论文没细看,如果找到相关理论了,记得分享下哈。