diff --git a/.gitignore b/.gitignore index ea48604..15b82a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,25 @@ -# Python +# Python & Bytecode __pycache__/ *.py[cod] +*$py.class +*.so +.Python +build/ +dist/ +*.egg-info/ + +# Environments & Virtual Environments .venv/ venv/ - -# Environments & IDEs +ENV/ +env/ .env + +# uv & Version Pinning +uv.lock +.python-version + +# IDEs & Notebooks .vscode/ .idea/ .ipynb_checkpoints/ @@ -13,3 +27,4 @@ venv/ # OS .DS_Store Thumbs.db + diff --git a/experiments/08_sentimen_gap.py b/experiments/08_sentimen_gap.py index 859de54..a7cd5cd 100644 --- a/experiments/08_sentimen_gap.py +++ b/experiments/08_sentimen_gap.py @@ -1,6 +1,4 @@ import os -os.environ["TF_USE_LEGACY_KERAS"] = "1" # Bypass Keras 3 & optree - import re import numpy as np import pandas as pd @@ -16,11 +14,11 @@ from sklearn.metrics import ( ) import tensorflow as tf -import tf_keras as keras -from tf_keras import layers -from tf_keras.callbacks import EarlyStopping -from tf_keras.preprocessing.text import Tokenizer # type: ignore -from tf_keras.preprocessing.sequence import pad_sequences +from tensorflow import keras +from tensorflow.keras import layers +from tensorflow.keras.callbacks import EarlyStopping +from tensorflow.keras.preprocessing.text import Tokenizer # type: ignore +from tensorflow.keras.preprocessing.sequence import pad_sequences # ============================================================ # KONFIGURASI DIREKTORI PENYIMPANAN @@ -159,7 +157,7 @@ print("SEL 9 — MODEL GAP") print("=" * 60) sent_model = keras.Sequential([ - layers.Embedding(input_dim=VOCAB_SIZE, output_dim=EMBED_DIM, input_length=MAX_LEN), + layers.Embedding(input_dim=VOCAB_SIZE, output_dim=EMBED_DIM), layers.GlobalAveragePooling1D(), layers.Dense(64, activation="relu"), layers.Dropout(0.4), diff --git a/results/figures/confusion_matrix_gap_sentimen.png b/results/figures/confusion_matrix_gap_sentimen.png index af8f2ba..8b1a2b8 100644 Binary files a/results/figures/confusion_matrix_gap_sentimen.png and b/results/figures/confusion_matrix_gap_sentimen.png differ diff --git a/results/figures/distribusi_label_sentimen.png b/results/figures/distribusi_label_sentimen.png new file mode 100644 index 0000000..b98ee98 Binary files /dev/null and b/results/figures/distribusi_label_sentimen.png differ diff --git a/results/figures/histori_gap_sentimen.png b/results/figures/histori_gap_sentimen.png new file mode 100644 index 0000000..165229d Binary files /dev/null and b/results/figures/histori_gap_sentimen.png differ diff --git a/results/figures/loss_regularization.png b/results/figures/loss_regularization.png index ea1fbd5..4b839c1 100644 Binary files a/results/figures/loss_regularization.png and b/results/figures/loss_regularization.png differ diff --git a/results/models/model_c_regularized.keras b/results/models/model_c_regularized.keras index 3c1460b..b3d575b 100644 Binary files a/results/models/model_c_regularized.keras and b/results/models/model_c_regularized.keras differ diff --git a/results/models/model_gap_sentimen.keras b/results/models/model_gap_sentimen.keras index 9213c15..0cbefba 100644 Binary files a/results/models/model_gap_sentimen.keras and b/results/models/model_gap_sentimen.keras differ diff --git a/results/reports/classification_report_gap_sentimen.txt b/results/reports/classification_report_gap_sentimen.txt index 3361e6f..b5a60ad 100644 --- a/results/reports/classification_report_gap_sentimen.txt +++ b/results/reports/classification_report_gap_sentimen.txt @@ -1,8 +1,8 @@ precision recall f1-score support - Negatif (0) 0.58 0.34 0.42 185 - Positif (1) 0.98 0.99 0.99 7572 + Negatif (0) 0.59 0.22 0.32 185 + Positif (1) 0.98 1.00 0.99 7572 accuracy 0.98 7757 - macro avg 0.78 0.66 0.71 7757 -weighted avg 0.97 0.98 0.98 7757 + macro avg 0.78 0.61 0.65 7757 +weighted avg 0.97 0.98 0.97 7757