cnn-text-classification-tf-chinese icon indicating copy to clipboard operation
cnn-text-classification-tf-chinese copied to clipboard

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

Open jxua opened this issue 7 years ago • 8 comments

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

jxua avatar Jul 20 '17 03:07 jxua

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

indiejoseph avatar Jul 20 '17 03:07 indiejoseph

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

heloowird avatar Aug 29 '17 08:08 heloowird

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

indiejoseph avatar Aug 29 '17 08:08 indiejoseph

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

heloowird avatar Aug 29 '17 09:08 heloowird

indiejoseph avatar Aug 29 '17 09:08 indiejoseph

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

m3744 avatar Sep 15 '17 04:09 m3744

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

indiejoseph avatar Sep 15 '17 06:09 indiejoseph

@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思想。以上论文没细看,如果找到相关理论了,记得分享下哈。

heloowird avatar Sep 15 '17 07:09 heloowird