ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်
Feature Engineering ဆိုတာ raw data ကနေ model ကို ပိုအထောက်အကူဖြစ်စေမယ့် feature အသစ်တွေ ဖန်တီးခြင်း/ရွေးချယ်ခြင်းပါ — 'Garbage in, garbage out' ဆိုတဲ့ principle အရ, feature ကောင်းကောင်း မရှိရင် algorithm ဘယ်လောက် sophisticated ဖြစ်ဖြစ် performance ကောင်းလို့ မရနိုင်ပါ။ Categorical Encoding ကတော့ text category (ဥပမာ - 'red', 'blue', 'green') ကို number ဆီ ပြောင်းလဲခြင်းပါ — One-Hot Encoding (category တစ်ခုချင်းစီအတွက် binary column သီးခြား ဖန်တီး) ကို အသုံးအများဆုံးပါ။ Feature Selection ကတော့ relevant မဟုတ်တဲ့/redundant feature ကို ဖယ်ရှားခြင်းပါ (noise လျှော့ချ, model ကို ပိုမြန်စေဖို့).
လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်
House data ထဲမှာ 'purchase_date' column ကို တိုက်ရိုက် feature အနေနဲ့ သုံးမယ့်အစား, 'house_age' (current_year - built_year) ဆိုတဲ့ feature အသစ်ကို engineer လုပ်ရင် model ကို ပိုအထောက်အကူ ဖြစ်စေနိုင်ပါတယ် — `pd.get_dummies(df['neighborhood'])` လို့ run ရင် 'neighborhood' categorical column ကို One-Hot Encoding ဖြင့် binary column အများ (neighborhood_A, neighborhood_B, ...) ဆီ ပြောင်းလဲပေးပါတယ်.
အတူတူ ကြည့်မယ်
import pandas as pd
# Feature engineering: derive house_age from built_year
df['house_age'] = 2026 - df['built_year']
# One-hot encode a categorical column
df_encoded = pd.get_dummies(df, columns=['neighborhood'])
print(df_encoded.columns.tolist())['size', 'built_year', 'price', 'house_age', 'neighborhood_A', 'neighborhood_B', 'neighborhood_C']၅ မိနစ် စမ်းကြည့်
Sample dataset (categorical column တစ်ခု, date column တစ်ခု ပါတဲ့) ကို ကိုယ်တိုင် create ပြီး, feature engineering (age derive) + One-Hot Encoding ၂ ခုလုံးကို run ကြည့်ပါ။
သတိလေးတစ်ချက်
Feature engineering ကို test data leak ဖြစ်စေမယ့်ပုံစံနဲ့ မလုပ်ပါနှင့် (ဥပမာ - dataset တစ်ခုလုံးရဲ့ average ကို feature အနေနဲ့ ဖန်တီးခြင်း, test data ရဲ့ information ကို indirect ပါဝင်သွားနိုင်) — training data ကနေသာ statistic ကို ဆွဲယူပြီး test data ကို apply လုပ်ရပါမယ်.