test 3
This commit is contained in:
parent
bf33351acc
commit
5ec1581437
1394
dev-0/out.tsv
1394
dev-0/out.tsv
File diff suppressed because it is too large
Load Diff
13
run.py
13
run.py
@ -1,6 +1,8 @@
|
||||
import pandas as pd
|
||||
from gensim.models import KeyedVectors
|
||||
from sklearn.model_selection import train_test_split
|
||||
import tensorflow as tf
|
||||
from keras.optimizers import Adam
|
||||
import numpy as np
|
||||
|
||||
|
||||
@ -41,6 +43,10 @@ def main():
|
||||
[text_to_vector(text, word2vec, vector_size) for text in test_A_dataset["Text"]]
|
||||
)
|
||||
|
||||
train_vectors, val_vectors, train_labels, val_labels = train_test_split(
|
||||
train_vectors, train_dataset["Class"], test_size=0.1, random_state=42
|
||||
)
|
||||
|
||||
# Train a simple neural network
|
||||
model = tf.keras.Sequential(
|
||||
[
|
||||
@ -52,15 +58,16 @@ def main():
|
||||
)
|
||||
|
||||
model.compile(
|
||||
optimizer="adam",
|
||||
optimizer=Adam(learning_rate=1e-3),
|
||||
loss="binary_crossentropy",
|
||||
metrics=["accuracy"],
|
||||
)
|
||||
|
||||
model.fit(
|
||||
train_vectors,
|
||||
train_dataset["Class"],
|
||||
epochs=10,
|
||||
train_labels,
|
||||
validation_data=(val_vectors, val_labels),
|
||||
epochs=30,
|
||||
batch_size=16,
|
||||
)
|
||||
|
||||
|
1312
test-A/out.tsv
1312
test-A/out.tsv
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user