From 18824e05c001b822b7c385c8d1bb3a95eec0d7d3 Mon Sep 17 00:00:00 2001 From: nuluh Date: Thu, 17 Jul 2025 00:18:01 +0700 Subject: [PATCH] refactor(ml): update inference calls to use new model structure and improve clarity --- code/src/ml/inference.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/code/src/ml/inference.py b/code/src/ml/inference.py index bf28fc7..88a7b96 100644 --- a/code/src/ml/inference.py +++ b/code/src/ml/inference.py @@ -1,9 +1,16 @@ from src.ml.model_selection import inference_model +from joblib import load -model = {"SVM": "D:/thesis/models/sensor1/SVM.joblib", - "SVM with PCA": "D:/thesis/models/sensor1/SVM with StandardScaler and PCA.joblib", - "XGBoost": "D:/thesis/models/sensor1/XGBoost.joblib"} +x = 30 +file = f"D:/thesis/data/dataset_B/zzzBD{x}.TXT" +sensor = 1 +model = {"SVM": f"D:/thesis/models/sensor{sensor}/SVM.joblib", + "SVM with PCA": f"D:/thesis/models/sensor{sensor}/SVM with StandardScaler and PCA.joblib", + "XGBoost": f"D:/thesis/models/sensor{sensor}/XGBoost.joblib"} -# inference_model(model["SVM"], "D:/thesis/data/dataset_A/zzzAD10.TXT", column_question=10) -# inference_model(model["SVM with PCA"], "D:/thesis/data/dataset_A/zzzAD10.TXT", column_question=10) -inference_model(model["XGBoost"], "D:/thesis/data/dataset_A/zzzAD30.TXT", column_question=30) \ No newline at end of file +index = ((x-1) % 5) + 1 +inference_model(model["SVM"], file, column_question=index) +print("---") +inference_model(model["SVM with PCA"], file, column_question=index) +print("---") +inference_model(model["XGBoost"], file, column_question=index) \ No newline at end of file