【NLP】IMDB和THUCNews数据集的探索

数据集下载探索模块:IMDB数据集(英文)和THUCNews数据集(中文)

THUCNews中文数据集:https://pan.baidu.com/s/1hugrfRu 密码:qfud
下载后为四个文件,cnews.train.txtcnews.val.txtcnews.test.txtcnews.vocab.txt

IMDB英文数据集: IMDB数据集 Sentiment Analysis
或者使用keras

IMDB Movie reviews sentiment classification

  • Dataset of 25,000 movies reviews from IMDB, labeled by sentiment (positive/negative). Reviews have been preprocessed, and each review is encoded as a sequence of word indexes (integers). For convenience, words are indexed by overall frequency in the dataset, so that for instance the integer “3” encodes the 3rd most frequent word in the data. This allows for quick filtering operations such as: “only consider the top 10,000 most common words, but eliminate the top 20 most common words”.
  • As a convention, “0” does not stand for a specific word, but instead is used to encode any unknown word.
from keras.datasets import imdb

(x_train, y_train), (x_test, y_test) = imdb.load_data(path="imdb.npz",
                                                      num_words=None,
                                                      skip_top=0,
                                                      maxlen=None,
                                                      seed=113,
                                                      start_char=1,
                                                      oov_char=2,
                                                      index_from=3)
  • Returns:

    • 2 tuples:
      • x_train, x_test: list of sequences, which are lists of indexes (integers). If the num_words argument was specific, the maximum possible index value is num_words-1. If the maxlen argument was specified, the largest possible sequence length is maxlen.
      • y_train, y_test: list of integer labels (1 or 0).
  • Arguments:

    • path: if you do not have the data locally (at ‘~/.keras/datasets/’ + path), it will be downloaded to this location.
    • num_words: integer or None. Top most frequent words to consider. Any less frequent word will appear as oov_char value in the sequence data.
    • skip_top: integer. Top most frequent words to ignore (they will appear as oov_char value in the sequence data).
    • maxlen: int. Maximum sequence length. Any longer sequence will be truncated.
    • seed: int. Seed for reproducible data shuffling.
    • start_char: int. The start of a sequence will be marked with this character. Set to 1 because 0 is usually the padding character.
    • oov_char: int. words that were cut out because of the num_words or skip_top limit will be replaced with this character.
    • index_from: int. Index actual words with this index and higher.

复习召回率、准确率、ROC曲线、AUC、PR曲线的基本概念

ROC

猜你喜欢

转载自blog.csdn.net/weixin_42317507/article/details/89162889