資源簡介
汽車評論情感分析代碼,采用TEXTCNN進行訓練與預測,里面包含詳細代碼及標注數據集;
代碼片段和文件信息
class?CONFIG():
????update_w2v?=?True???????????#?是否在訓練中更新w2v
????vocab_size?=?37814??????????#?詞匯量,與word2id中的詞匯量一致
????n_class?=?2?????????????????#?分類數:分別為pos和neg
????max_sen_len?=?75????????????#?句子最大長度
????embedding_dim?=?50??????????#?詞向量維度
????batch_size?=?100????????????#?批處理尺寸
????n_hidden?=?256??????????????#?隱藏層節點數
????n_epoch?=?10????????????????#?訓練迭代周期,即遍歷整個訓練樣本的次數
????opt?=?‘adam‘????????????????#?訓練優化器:adam或者adadelta
????learning_rate?=?0.001???????#?學習率;若opt=‘adadelta‘,則不需要定義學習率
????drop_keep_prob?=?0.5????????#?dropout層,參數keep的比例
????num_filters?=?256???????????#?卷積層filter的數量
????kernel_size?=?3?????????????#?卷積核的尺寸;nlp任務中通常選擇2345
????print_per_batch?=?100???????#?訓練過程中每100詞batch迭代,打印訓練信息
????save_dir?=?‘./checkpoints/‘?#?訓練模型保存的地址
????train_path?=?‘./data/ch_auto_train.txt‘
????dev_path?=?‘./data/ch_auto_dev.txt‘
????test_path?=?‘./data/ch_auto_test.txt‘
????word2id_path?=?‘./data/word_to_id.txt‘
????pre_word2vec_path?=?‘./data/wiki_word2vec_50.bin‘
????corpus_word2vec_path?=?‘./data/corpus_word2vec.txt‘
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-02-25?00:15??SentimentAnalysis-master\
?????文件????????1356??2018-05-15?15:28??SentimentAnalysis-master\CONFIG.py
?????目錄???????????0??2018-05-15?15:28??SentimentAnalysis-master\data\
?????文件?????1245383??2018-05-15?15:28??SentimentAnalysis-master\data\ch_auto_dev.txt
?????文件?????2704954??2018-05-15?15:28??SentimentAnalysis-master\data\ch_auto_test.txt
?????文件?????4879983??2018-05-15?15:28??SentimentAnalysis-master\data\ch_auto_train.txt
?????文件????29313375??2018-05-15?15:28??SentimentAnalysis-master\data\corpus_word2vec.txt
?????文件????89008408??2018-05-15?15:28??SentimentAnalysis-master\data\wiki_word2vec_50.bin
?????文件??????543216??2018-05-15?15:28??SentimentAnalysis-master\data\word_to_id.txt
?????文件????????1927??2018-05-15?15:28??SentimentAnalysis-master\predict.py
?????文件????????7388??2018-05-15?15:28??SentimentAnalysis-master\TextCNN.py
?????文件????????2191??2018-05-15?15:28??SentimentAnalysis-master\train_and_eva.py
?????文件????????4747??2018-05-15?15:28??SentimentAnalysis-master\utils.py
評論
共有 條評論