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".
dataset_imdb(
path = "imdb.npz",
num_words = NULL,
skip_top = 0L,
maxlen = NULL,
seed = 113L,
start_char = 1L,
oov_char = 2L,
index_from = 3L
)dataset_imdb_word_index(path = "imdb_word_index.json")
Lists of training and test data: train$x, train$y, test$x, test$y
.
The x
data includes integer sequences. 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`.
The y
data includes a set of integer labels (0 or 1).
The dataset_imdb_word_index()
function returns a list where the
names are words and the values are integer.
Where to cache the data (relative to ~/.keras/dataset
).
Max number of words to include. Words are ranked by how often they occur (in the training set) and only the most frequent words are kept
Skip the top N most frequently occuring words (which may not be informative).
sequences longer than this will be filtered out.
random seed for sample shuffling.
The start of a sequence will be marked with this character. Set to 1 because 0 is usually the padding character.
Words that were cut out because of the num_words
or
skip_top
limit will be replaced with this character.
Index actual words with this index and higher.
As a convention, "0" does not stand for a specific word, but instead is used to encode any unknown word.
Other datasets:
dataset_boston_housing()
,
dataset_cifar100()
,
dataset_cifar10()
,
dataset_fashion_mnist()
,
dataset_mnist()
,
dataset_reuters()