【发布时间】:2022-01-16 21:29:58
【问题描述】:
所以,我按照这个例子:
https://keras.io/examples/nlp/pretrained_word_embeddings/
在此示例中,在以下部分中生成嵌入矩阵
num_tokens = len(voc) + 2
embedding_dim = 100
hits = 0
misses = 0
# Prepare embedding matrix
embedding_matrix = np.zeros((num_tokens, embedding_dim))
for word, i in word_index.items():
embedding_vector = embeddings_index.get(word)
if embedding_vector is not None:
# Words not found in embedding index will be all-zeros.
# This includes the representation for "padding" and "OOV"
embedding_matrix[i] = embedding_vector
hits += 1
else:
misses += 1
print("Converted %d words (%d misses)" % (hits, misses))
如何将其推送到 cassandra 和 hive。我试过以下查询:
statement = "CREATE TABLE schema.upcoming_calendar3 ( embedding_matrix list
但是,这给了我以下错误:
InvalidRequest:来自服务器的错误:code=2200 [Invalid query] message="Invalid non-frozen collection type for PRIMARY KEY component embedding_matrix"
同样,我也想将它发送到 hive。
任何关于在 cassandra 和 hive 中使用什么数据类型的帮助以及将其发送到数据库的更有效方式都会很棒。
目前,我正在推送这样的数据:
statement = "插入 schema.upcoming_calendar3(embedding_matrix) 值 (%s);" % (embedding_matrix)
【问题讨论】:
标签: python hive cassandra tensorflow2.0