得到错误消息:“ IndexError:索引1499超出了轴1的大小1499的范围”

时间:2019-06-09 17:19:05

标签: python keras lstm

我正在从Kaggle运行双向LSTM层的代码:https://www.kaggle.com/snlpnkj/bidirectional-lstm-keras

当我输入以下代码块时,出现“ IndexError:索引1499超出了轴0的大小1499的范围”的消息:

word_index = tokenizer.word_index
nb_words = min(max_features, len(word_index))
embedding_matrix = np.random.normal(emb_mean, emb_std, (nb_words, 
embed_size))
for word, i in word_index.items():
   if i >= max_features: continue
   embedding_vector = embeddings_index.get(word)
   if embedding_vector is not None: embedding_matrix[i] =embedding_vector

有任何修复建议吗?

0 个答案:

没有答案