ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်
SVM ရဲ့ core idea က class ၂ ခုကို ခွဲခြားတဲ့ boundary (decision boundary) ကို ရှာတဲ့အခါ, class နှစ်ခုစလုံးက boundary နဲ့ 'ဝေးဝေးဆုံး' ဖြစ်အောင် (maximum margin) ရှာဖွေခြင်းပါ — boundary နဲ့ အနီးဆုံးက data point တွေကို 'Support Vector' လို့ ခေါ်ပါတယ် (boundary ကို ဆုံးဖြတ်ပေးတဲ့ point တွေဖြစ်လို့ ဒီနာမည်ရတာပါ)။ Kernel Trick ကတော့ data ကို linear boundary ဖြင့် ခွဲခြား၍ မရတဲ့ scenario (data ကို circle ပုံစံလိုမျိုး ပြန့်ကျဲနေတဲ့) မှာ data ကို higher dimension ဆီ mathematically ပြောင်းလဲပြီး, linear boundary ရှာနိုင်စေတဲ့ technique ပါ (`kernel='linear'`, `kernel='rbf'` စတာမျိုး ရွေးချယ်နိုင်ပါတယ်).
လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်
`from sklearn.svm import SVC; model = SVC(kernel='rbf'); model.fit(X_train, y_train)` လို့ ရေးရင် — 'rbf' (Radial Basis Function) kernel ကို သုံးပြီး, linear boundary နဲ့ ခွဲမရတဲ့ complex pattern ကိုပါ classify နိုင်ပါတယ် — image classification, text classification (spam detection) ကဲ့သို့ high-dimensional feature space ရှိတဲ့ problem တွေမှာ SVM က traditionally strong performance ပြသလေ့ရှိပါတယ်.
အတူတူ ကြည့်မယ်
from sklearn.svm import SVC
# 'rbf' kernel handles non-linear decision boundaries
model = SVC(kernel='rbf', C=1.0)
model.fit(X_train, y_train)
accuracy = model.score(X_test, y_test)
print(f"SVM accuracy: {accuracy:.2f}")SVM accuracy: 0.89၅ မိနစ် စမ်းကြည့်
SVM model ကို `kernel='linear'` နှင့် `kernel='rbf'` ၂ မျိုးနဲ့ train ကြည့်ပြီး, accuracy result ကို compare ကြည့်ပါ — dataset ရဲ့ pattern က linear ဒါမှမဟုတ် non-linear ဆိုတာ ဘယ် kernel ကနေ ပိုကောင်းလဲ ကနေ ခန့်မှန်းနိုင်ပါတယ်.
သတိလေးတစ်ချက်
SVM ရဲ့ hyperparameter (`C`, kernel parameter) ကို tune မလုပ်ဘဲ default value ကို သုံးရင် — performance suboptimal ဖြစ်နိုင်ပါတယ်, Hyperparameter Tuning (နောက် lesson) ကို ဆက်လေ့လာပါ.