add bert script
This commit is contained in:
commit
e77c9e41d1
@ -51,9 +51,9 @@ def use_word2vec():
|
|||||||
return w2v
|
return w2v
|
||||||
|
|
||||||
def document_vector(w2v, x_train, x_dev, x_test):
|
def document_vector(w2v, x_train, x_dev, x_test):
|
||||||
x_train = [np.mean([w2v[w] for w in doc if w in w2v] or [np.zeros(300)], axis = 0) for doc in x_train]
|
x_train = [np.mean([w2v[word] for word in doc if word in w2v] or [np.zeros(300)], axis = 0) for doc in x_train]
|
||||||
x_dev = [np.mean([w2v[w] for w in doc if w in w2v] or [np.zeros(300)], axis = 0) for doc in x_dev]
|
x_dev = [np.mean([w2v[word] for word in doc if word in w2v] or [np.zeros(300)], axis = 0) for doc in x_dev]
|
||||||
x_test = [np.mean([w2v[w] for w in doc if w in w2v] or [np.zeros(300)], axis = 0) for doc in x_test]
|
x_test = [np.mean([w2v[word] for word in doc if word in w2v] or [np.zeros(300)], axis = 0) for doc in x_test]
|
||||||
|
|
||||||
return x_train, x_dev, x_test
|
return x_train, x_dev, x_test
|
||||||
|
|
||||||
@ -119,5 +119,5 @@ def main():
|
|||||||
y_dev, y_test = prediction(nn_model, BATCH_SIZE, x_dev, x_test)
|
y_dev, y_test = prediction(nn_model, BATCH_SIZE, x_dev, x_test)
|
||||||
get_result(y_dev, y_test)
|
get_result(y_dev, y_test)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if _name_ == '_main_':
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user