Compare commits

..
5 Commits
42 changed files with 1547 additions and 3 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

+1 -1
View File
@@ -1,4 +1,4 @@
numpy
pandas
matplotlib
scikit-learn
Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

+2
View File
@@ -0,0 +1,2 @@
config,preprocess,model,params,mean_acc,std_acc
scale + svm,scale,svm,"{'kernel': 'rbf', 'C': 4, 'gamma': 'scale', 'class_weight': None}",0.8581719138625145,0.013348223889216927
1 config preprocess model params mean_acc std_acc
2 scale + svm scale svm {'kernel': 'rbf', 'C': 4, 'gamma': 'scale', 'class_weight': None} 0.8581719138625145 0.013348223889216927
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+185
View File
@@ -0,0 +1,185 @@
/home/hoo2/Work/AUTh/PatternRecognition/Assignment_2025-26/.venv/bin/python /home/hoo2/Work/AUTh/PatternRecognition/Assignment_2025-26/src/partD.py all
[ scale] [ gnb] val_acc=0.7095
[ scale] [ rf] val_acc=0.8205
[ scale] [ logreg] val_acc=0.7730
[ scale] [linear_svm] val_acc=0.7707
[ scale] [ svm] val_acc=0.8593
[ scale] [ mlp] val_acc=0.8382
[ scale] [ knn] val_acc=0.8342
[ scale] [ adaboost] val_acc=0.6832
[scale_pca_66] [ gnb] val_acc=0.7524
[scale_pca_66] [ rf] val_acc=0.8096
[scale_pca_66] [ logreg] val_acc=0.7862
[scale_pca_66] [linear_svm] val_acc=0.7736
[scale_pca_66] [ svm] val_acc=0.8582
[scale_pca_66] [ mlp] val_acc=0.8359
[scale_pca_66] [ knn] val_acc=0.8370
[scale_pca_66] [ adaboost] val_acc=0.6878
[scale_pca_75] [ gnb] val_acc=0.7547
[scale_pca_75] [ rf] val_acc=0.8130
[scale_pca_75] [ logreg] val_acc=0.7839
[scale_pca_75] [linear_svm] val_acc=0.7696
[scale_pca_75] [ svm] val_acc=0.8565
[scale_pca_75] [ mlp] val_acc=0.8216
[scale_pca_75] [ knn] val_acc=0.8370
[scale_pca_75] [ adaboost] val_acc=0.6878
[scale_pca_85] [ gnb] val_acc=0.7501
[scale_pca_85] [ rf] val_acc=0.8033
[scale_pca_85] [ logreg] val_acc=0.7810
[scale_pca_85] [linear_svm] val_acc=0.7662
[scale_pca_85] [ svm] val_acc=0.8588
[scale_pca_85] [ mlp] val_acc=0.8188
[scale_pca_85] [ knn] val_acc=0.8388
[scale_pca_85] [ adaboost] val_acc=0.6998
=== Investigation summary ===
model
svm 0.859348
knn 0.838765
mlp 0.838193
rf 0.820469
logreg 0.786164
linear_svm 0.773585
gnb 0.754717
adaboost 0.699828
Selected top-3 models for further analysis: ['svm', 'knn', 'mlp']
Best configuration overall: preprocess=scale, model=svm, val_acc=0.8593
Classification report (best config):
precision recall f1-score support
1 0.94 0.96 0.95 354
2 0.76 0.73 0.75 344
3 0.92 0.93 0.93 351
4 0.91 0.91 0.91 343
5 0.75 0.77 0.76 357
accuracy 0.86 1749
macro avg 0.86 0.86 0.86 1749
weighted avg 0.86 0.86 0.86 1749
[TUNING] scale + rf (cv=5) ...
[scale | rf] combo 1/1 mean=0.8228 params={'n_estimators': 400, 'max_depth': None, 'max_features': 'sqrt', 'min_samples_split': 4, 'min_samples_leaf': 1}
best mean_acc=0.8228 (std=0.0121) params={'n_estimators': 400, 'max_depth': None, 'max_features': 'sqrt', 'min_samples_split': 4, 'min_samples_leaf': 1}
[TUNING] scale + mlp (cv=5) ...
[scale | mlp] combo 1/1 mean=0.8407 params={'hidden_layer_sizes': (128,), 'alpha': 0.001, 'learning_rate_init': 0.01, 'activation': 'relu', 'solver': 'adam'}
best mean_acc=0.8407 (std=0.0098) params={'hidden_layer_sizes': (128,), 'alpha': 0.001, 'learning_rate_init': 0.01, 'activation': 'relu', 'solver': 'adam'}
[TUNING] scale_pca_85 + knn (cv=5) ...
[scale_pca_85 | knn] combo 1/1 mean=0.8313 params={'n_neighbors': 9, 'weights': 'distance', 'p': 2}
best mean_acc=0.8313 (std=0.0117) params={'n_neighbors': 9, 'weights': 'distance', 'p': 2}
[TUNING] scale + svm (cv=5) ...
[scale | svm] combo 1/1 mean=0.8582 params={'kernel': 'rbf', 'C': 4, 'gamma': 'scale', 'class_weight': None}
best mean_acc=0.8582 (std=0.0133) params={'kernel': 'rbf', 'C': 4, 'gamma': 'scale', 'class_weight': None}
=== Tuning summary (best overall) ===
{'name': 'scale + svm', 'preprocess_spec': {'type': 'pipeline', 'steps': [{'type': 'scaler', 'params': {}}]}, 'preprocess_name': 'scale', 'model': 'svm', 'params': {'kernel': 'rbf', 'C': 4, 'gamma': 'scale', 'class_weight': None}, 'mean_acc': 0.8581719138625145, 'std_acc': 0.013348223889216927}
============================================================
[FINAL - VALIDATION] scale + rf
Confusion matrix:
[[338 6 5 3 2]
[ 4 239 11 12 78]
[ 11 2 316 21 1]
[ 3 12 17 299 12]
[ 13 71 4 9 260]]
Classification report:
precision recall f1-score support
1 0.92 0.95 0.93 354
2 0.72 0.69 0.71 344
3 0.90 0.90 0.90 351
4 0.87 0.87 0.87 343
5 0.74 0.73 0.73 357
accuracy 0.83 1749
macro avg 0.83 0.83 0.83 1749
weighted avg 0.83 0.83 0.83 1749
============================================================
[FINAL] scale_rf: saved labelsX_scale_rf.npy shape=(6955,)
============================================================
[FINAL - VALIDATION] scale + mlp
Confusion matrix:
[[338 1 9 2 4]
[ 5 244 13 7 75]
[ 10 3 320 16 2]
[ 0 14 16 302 11]
[ 8 74 1 16 258]]
Classification report:
precision recall f1-score support
1 0.94 0.95 0.95 354
2 0.73 0.71 0.72 344
3 0.89 0.91 0.90 351
4 0.88 0.88 0.88 343
5 0.74 0.72 0.73 357
accuracy 0.84 1749
macro avg 0.83 0.84 0.83 1749
weighted avg 0.83 0.84 0.84 1749
============================================================
[FINAL] scale_mlp: saved labelsX_scale_mlp.npy shape=(6955,)
============================================================
[FINAL - VALIDATION] scale_pca_85 + knn
Confusion matrix:
[[346 2 5 0 1]
[ 5 193 9 7 130]
[ 19 1 319 11 1]
[ 4 9 17 301 12]
[ 8 33 1 6 309]]
Classification report:
precision recall f1-score support
1 0.91 0.98 0.94 354
2 0.81 0.56 0.66 344
3 0.91 0.91 0.91 351
4 0.93 0.88 0.90 343
5 0.68 0.87 0.76 357
accuracy 0.84 1749
macro avg 0.85 0.84 0.84 1749
weighted avg 0.85 0.84 0.84 1749
============================================================
[FINAL] scale_pca_85_knn: saved labelsX_scale_pca_85_knn.npy shape=(6955,)
============================================================
[FINAL - VALIDATION] scale + svm
Confusion matrix:
[[340 2 8 1 3]
[ 3 251 9 6 75]
[ 7 1 327 14 2]
[ 0 12 9 311 11]
[ 11 63 1 8 274]]
Classification report:
precision recall f1-score support
1 0.94 0.96 0.95 354
2 0.76 0.73 0.75 344
3 0.92 0.93 0.93 351
4 0.91 0.91 0.91 343
5 0.75 0.77 0.76 357
accuracy 0.86 1749
macro avg 0.86 0.86 0.86 1749
weighted avg 0.86 0.86 0.86 1749
============================================================
[FINAL] scale_svm: saved labelsX_scale_svm.npy shape=(6955,)
Saved labels to labelsX.npy with shape (6955,)
Process finished with exit code 0
+11
View File
@@ -197,6 +197,17 @@ def plot_gaussians_3d(
ax.set_zlabel("pdf")
plt.show()
# plt.figure(figsize=(6, 5))
# plt.scatter(X[:, 0], X[:, 1], s=10, alpha=0.35)
# plt.contour(Xgrid, Ygrid, Z, levels=8, linewidths=1.5)
#
# plt.title("Estimated Gaussian density (ML)")
# plt.xlabel("x₁")
# plt.ylabel("x₂")
#
# plt.tight_layout()
# plt.show()
# --------------------------------------------------
+1 -1
View File
@@ -302,7 +302,7 @@ def plot_histogram_with_pdf(
plt.plot(x_plot, pdf_true, label=f"True N({mu_true}, {var_true}) pdf")
plt.xlabel("x")
plt.ylabel("Density")
plt.title("Dataset2 histogram vs true N({mu_true}, {var_true}) pdf")
plt.title(f"Dataset2 histogram vs true N({mu_true}, {var_true}) pdf")
plt.legend()
plt.grid(True)
plt.show()
+1343
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+2 -1
View File
@@ -21,7 +21,8 @@ dataset1 = github_raw("hoo2", "PR-Assignment2025_26", "master", "datasets/datase
dataset2 = github_raw("hoo2", "PR-Assignment2025_26", "master", "datasets/dataset2.csv")
dataset3 = github_raw("hoo2", "PR-Assignment2025_26", "master", "datasets/dataset3.csv")
testset = github_raw("hoo2", "PR-Assignment2025_26", "master", "datasets/testset.csv")
datasetTV = github_raw("hoo2", "PR-Assignment2025_26", "master", "datasets/datasetTV.csv")
datasetTest = github_raw("hoo2", "PR-Assignment2025_26", "master", "datasets/datasetTest.csv")
def load_csv(path, header=None):
"""