This commit is contained in:
Mateusz 2024-05-16 14:30:49 +02:00
parent bf33351acc
commit 5ec1581437
3 changed files with 1363 additions and 1356 deletions

File diff suppressed because it is too large Load Diff

13
run.py
View File

@ -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,
)

File diff suppressed because it is too large Load Diff