feat(notebooks): training model with new alternative undamaged (label 0) data

This commit is contained in:
nuluh
2025-06-27 10:34:23 +07:00
parent d6975b4817
commit 465ed121f9

View File

@@ -443,6 +443,37 @@
"plt.pcolormesh(ready_data2a[0].transpose(), cmap='jet', vmax=0.03, vmin=0.0)" "plt.pcolormesh(ready_data2a[0].transpose(), cmap='jet', vmax=0.03, vmin=0.0)"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ready_data1b = []\n",
"for file in os.listdir('D:/thesis/data/converted/raw_B/sensor1'):\n",
" ready_data1b.append(pd.read_csv(os.path.join('D:/thesis/data/converted/raw_B/sensor1', file), skiprows=1))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# dpi\n",
"plt.figure(dpi=300) # Set figure size and DPI\n",
"plt.pcolormesh(ready_data1b[0].iloc[:22,:].transpose(), cmap='jet', vmax=0.03, vmin=0.0)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"len(ready_data1b[0])"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@@ -660,8 +691,8 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"X1a.iloc[-1,:]\n", "# X1a.iloc[-1,:]\n",
"# y[2565]" "y[2564]"
] ]
}, },
{ {
@@ -717,6 +748,7 @@
"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",
"# Define models for sensor1\n", "# Define models for sensor1\n",
"models_sensor1 = {\n", "models_sensor1 = {\n",
" # \"Random Forest\": RandomForestClassifier(),\n", " # \"Random Forest\": RandomForestClassifier(),\n",
@@ -724,14 +756,14 @@
" # \"Decision Tree\": DecisionTreeClassifier(),\n", " # \"Decision Tree\": DecisionTreeClassifier(),\n",
" # \"KNN\": KNeighborsClassifier(),\n", " # \"KNN\": KNeighborsClassifier(),\n",
" # \"LDA\": LinearDiscriminantAnalysis(),\n", " # \"LDA\": LinearDiscriminantAnalysis(),\n",
" \"SVM\": SVC(),\n", " # \"SVM\": SVC(),\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')\n",
" ),\n", " # ),\n",
"\n", "\n",
" # \"XGBoost\": XGBClassifier()\n", " \"XGBoost\": XGBClassifier()\n",
"}\n", "}\n",
"\n", "\n",
"results_sensor1 = []\n", "results_sensor1 = []\n",