refactor(stft): comment out unused imports and update SVM model loading for consistency

This commit is contained in:
nuluh
2025-07-28 05:22:24 +07:00
parent 3cbef17b0c
commit 3e2b153d11

View File

@@ -636,11 +636,11 @@
"from sklearn.preprocessing import StandardScaler\n", "from sklearn.preprocessing import StandardScaler\n",
"from sklearn.svm import SVC\n", "from sklearn.svm import SVC\n",
"from sklearn.decomposition import PCA\n", "from sklearn.decomposition import PCA\n",
"from xgboost import XGBClassifier\n", "# from xgboost import XGBClassifier\n",
"from sklearn.ensemble import RandomForestClassifier, BaggingClassifier\n", "# from sklearn.ensemble import RandomForestClassifier, BaggingClassifier\n",
"from sklearn.tree import DecisionTreeClassifier\n", "# from sklearn.tree import DecisionTreeClassifier\n",
"from sklearn.neighbors import KNeighborsClassifier\n", "# from sklearn.neighbors import KNeighborsClassifier\n",
"from sklearn.discriminant_analysis import LinearDiscriminantAnalysis\n", "# from sklearn.discriminant_analysis import LinearDiscriminantAnalysis\n",
"from sklearn.neural_network import MLPClassifier\n", "from sklearn.neural_network import MLPClassifier\n",
"\n" "\n"
] ]
@@ -669,11 +669,11 @@
" # StandardScaler(),\n", " # StandardScaler(),\n",
" # SVC(kernel='rbf', probability=True)\n", " # SVC(kernel='rbf', probability=True)\n",
" # ),\n", " # ),\n",
" # \"SVM with StandardScaler and PCA\": make_pipeline(\n", " \"SVM with StandardScaler and PCA\": make_pipeline(\n",
" # StandardScaler(),\n", " StandardScaler(),\n",
" # PCA(n_components=10),\n", " PCA(n_components=10),\n",
" # SVC(kernel='rbf')\n", " SVC(kernel='rbf', probability=True)\n",
" # ),\n", " ),\n",
"\n", "\n",
" # \"XGBoost\": XGBClassifier()\n", " # \"XGBoost\": XGBClassifier()\n",
" \"MLPClassifier\": make_pipeline(\n", " \"MLPClassifier\": make_pipeline(\n",
@@ -818,8 +818,22 @@
"source": [ "source": [
"# 4. Sensor A Validate on Dataset B\n", "# 4. Sensor A Validate on Dataset B\n",
"from joblib import load\n", "from joblib import load\n",
"svm_model = load('D:/thesis/models/sensor1/SVM.joblib')\n", "svm_model = load('D:/thesis/models/Sensor A/SVM with StandardScaler and PCA.joblib')\n",
"y_pred_svm_1 = svm_model.predict(X1b)" "y_pred_svm_1 = svm_model.predict_proba(X1b)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
"# Set NumPy to display full decimal values\n",
"np.set_printoptions(suppress=True, precision=6) # Suppress scientific notation, set precision to 6 decimals\n",
"\n",
"y_pred_svm_1[1]"
] ]
}, },
{ {