Keras用IMDB数据源(imdb.npz + imdb_word_index.json)

时间:2020-08-02 19:43:32
【文件属性】:
文件名称:Keras用IMDB数据源(imdb.npz + imdb_word_index.json)
文件大小:17.27MB
文件格式:ZIP
更新时间:2020-08-02 19:43:32
imdb keras Keras用IMDB数据源(imdb.npz + imdb_word_index.json) from tensorflow.keras.datasets import imdb (train_data, train_labels), (test_data, test_labels) = imdb.load_data(num_words=10000) # word_index is a dictionary mapping words to an integer index word_index = imdb.get_word_index() # We reverse it, mapping integer indices to words reverse_word_index = dict([(value, key) for (key, value) in word_index.items()]) # We decode the review; note that our indices were offset by 3 # because 0, 1 and 2 are reserved indices for "padding", "start of sequence", and "unknown". decoded_review = ' '.join([reverse_word_index.get(i - 3, '?') for i in train_data[0]])
【文件预览】:
imdb_word_index.json
imdb.npz

网友评论