feat(src): refactor file dir

This commit is contained in:
nuluh
2025-10-07 06:05:17 +07:00
parent d8482988ff
commit c2aa68d2e9

View File

@@ -1,11 +1,12 @@
from joblib import load
import pandas as pd
from src.data_preprocessing import *
from src.process_stft import compute_stft
from data_preprocessing import *
from process_stft import compute_stft
from typing import List, Tuple
from sklearn.base import BaseEstimator
import json
def probability_damage(pred: Tuple[np.ndarray, np.ndarray], model_classes: BaseEstimator, percentage=False) -> Dict[str, int]:
"""
Process the prediction output to return unique labels and their counts.
@@ -132,16 +133,16 @@ def heatmap(result, damage_classes: list[int] = [1, 2, 3, 4, 5, 6]):
if __name__ == "__main__":
import matplotlib.pyplot as plt
import json
from scipy.interpolate import UnivariateSpline
# from scipy.interpolate import UnivariateSpline
result = inference(
"D:/thesis/models/Sensor A/SVM with StandardScaler and PCA.joblib",
"D:/thesis/models/Sensor B/SVM with StandardScaler and PCA.joblib",
"D:/thesis/data/dataset_B/zzzBD19.TXT"
"D:/thesis/data/dataset_B/zzzBU.TXT"
)
# heatmap(result)
heatmap(result)
# Convert all keys to strings before dumping to JSON
# result_with_string_keys = convert_keys_to_strings(result)
# print(json.dumps(result_with_string_keys, indent=4))