dataset-har-PUC-Rio-ugulino.data — မှတ်တမ်းပေါင်း 165,633 ခု)sitting, sittingdown, standing, standingup, walking) ခွဲခြားခန့်မှန်းတဲ့ ပရိုဂရမ် ဖြစ်ပါတယ်။အဆင့်တစ်ခုချင်းစီ၏ အသေးစိတ် ရှင်းလင်းချက်
TODO 1 & 3 (Dataset ဖတ်ယူခြင်းနှင့် ဒသမကိန်း ညှိခြင်း) ဖိုင်ထဲတွင် ကော်လံများကို
;ဖြင့် ခြားထားပြီး ဒသမနေရာတွင်.အစား,ကို သုံးထားသဖြင့်delimiter=';'နှင့်decimal=','ဖြင့် ဖတ်ယူရပါမည်။ TODO 2 (
genderကော်လံ Encode လုပ်ခြင်း)'Man'ကို0နှင့်'Woman'ကို1အဖြစ်.map({'Man': 0, 'Woman': 1})သုံး၍ ကိန်းဂဏန်း ပြောင်းရပါမည်။ TODO 4 (ပျက်စီးနေသော မှတ်တမ်းကို ဖယ်ရှားပြီး Numeric ပြောင်းခြင်း):
z4ကော်လံထဲမှ စာသားပါနေသော အတန်းကို စစ်ထုတ်ဖယ်ရှား (dropna) ပြီးနောက်pd.to_numeric(..., errors='raise')ဖြင့် ဂဏန်းစစ်စစ် ဖြစ်ကြောင်း အတည်ပြုရပါမည်။ TODO 5 & 6 (
yကို Dummies ပြောင်းခြင်းနှင့်user,classဖယ်ရှားခြင်း)classကော်လံကို Targetyအဖြစ် ခွဲထုတ်ပြီးXထဲမှclassအပြင် လူပုဂ္ဂိုလ်အမည် ပါဝင်နေသောuserကော်လံကိုပါ ဖယ်ရှားရပါမည်(အကယ်၍ userကို မဖယ်ရှားပါက Model သည် ကိုယ်ဟန်လှုပ်ရှားမှုအစား လူနာမည်ကို အလွတ်ကျက်မိသည့် Data Leakage ဖြစ်သွားပါမည်)။TODO 7, 8 & 9 (Random Forest တည်ဆောက်ခြင်း၊ OOB Score နှင့် Test Accuracy စစ်ဆေးခြင်း)
n_estimators=30, max_depth=10, oob_score=True, random_state=0ဖြင့် Random Forest ကို လေ့ကျင့်စေပြီး Out-of-Bag (OOB) ရမှတ်နှင့် 30% Test Data အပေါ် တိကျမှုကို နှိုင်းယှဉ်စစ်ဆေးရပါမည်။ TODO 10 (
genderကော်လံ ပြောင်းလဲစမ်းသပ်ခြင်း)Man:1, Woman:0ပြောင်းခြင်း၊pd.get_dummiesသုံးခြင်းနှင့်genderကော်လံကို လုံးဝဖယ်ရှားပစ်ခြင်း တို့က ရမှတ်အပေါ် မည်သို့သက်ရောက်သလဲ စမ်းသပ်ရပါမည်။ TODO 11 (
yTarget Encoding ပြောင်းလဲစမ်းသပ်ခြင်း)pd.get_dummies(y)အစား 1D Label Encoding (0, 1, 2, 3, 4) ကို ပြောင်းသုံးကြည့်ပါက တိကျမှု ပိုမိုမြင့်တက်လာပုံကို နှိုင်းယှဉ်စစ်ဆေးရပါမည်။
၃။ AIMA သီအိုရီများပါဝင်သော Python Code
gender Encoding စမ်းသပ်ချက် ၄ မျိုး၊ y Encoding စမ်းသပ်ချက် ၂ မျိုး နဲ့ Feature Importance + Confusion Matrix ဂရပ်ဖ် တို့ကိုပါ တစ်ပါတည်း ထည့်သွင်းရေးသားပေးထားပါတယ်။import time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from sklearn.metrics import accuracy_score, confusion_matrix, ConfusionMatrixDisplay
plt.style.use('ggplot')
# ==============================================================================
# အပိုင်း (၁) - Dataset ဖတ်ယူခြင်းနှင့် Data Cleaning
# AIMA (4th Ed.) Ch. 19, Sec. 19.9 (Developing Machine Learning Systems: Data Cleaning)
# သီအိုရီ - လက်တွေ့ကမ္ဘာရှိ အာရုံခံကိရိယာ (Wearable Accelerometer Sensors) ဒေတာများတွင်
# စက်ပိုင်းဆိုင်ရာ ချို့ယွင်းမှုကြောင့် ပျက်စီးနေသော မှတ်တမ်းများ (Corrupted Records) ပါဝင်တတ်သည်။
# ၎င်းတို့ကို စနစ်တကျ စစ်ထုတ်ဖယ်ရှားမှသာ သင်ယူမှုစနစ် (Learning Agent) မှန်ကန်စွာ အလုပ်လုပ်နိုင်မည်။
# ==============================================================================
file_path = r'C:\Users\kks\OneDrive\Desktop\MyPyTest\Module4\Datasets\dataset-har-PUC-Rio-ugulino.data'
# delimiter=';' နှင့် decimal=',' ထည့်ပေးခြင်းဖြင့် ကော်မာပါသော ဒသမကိန်းများကို အလိုအလျောက် ပြောင်းပေးသည်
X = pd.read_csv(file_path, delimiter=';', decimal=',', low_memory=False)
print(f"Initial Raw Dataset Shape: {X.shape}")
# TODO 2: gender ကော်လံကို 0 (Man) နှင့် 1 (Woman) အဖြစ် ပြောင်းလဲခြင်း
X['gender'] = X['gender'].map({'Man': 0, 'Woman': 1})
# TODO 4: z4 ကော်လံထဲရှိ ပျက်စီးနေသော စာသားမှတ်တမ်းကို ရှာဖွေဖယ်ရှားပြီး errors='raise' ဖြင့် စစ်ဆေးခြင်း
bad_z4_mask = pd.to_numeric(X['z4'], errors='coerce').isna()
print(f"Found and dropping {bad_z4_mask.sum()} corrupted record(s) in 'z4' column...")
X = X[~bad_z4_mask].reset_index(drop=True)
# ပျက်စီးနေသော အတန်းကို ဖယ်ရှားပြီးဖြစ်၍ errors='raise' ဖြင့် စိတ်ချစွာ Numeric ပြောင်းနိုင်ပြီ
X['z4'] = pd.to_numeric(X['z4'], errors='raise')
print("\nData Types after Cleaning:")
print(X.dtypes)
print(f"\nRemaining NaN rows count: {pd.isnull(X).any(axis=1).sum()}")
# ==============================================================================
# အပိုင်း (၂) - Target (y) နှင့် Input Features (X) ခွဲခြားခြင်း
# AIMA (4th Ed.) Ch. 19, Sec. 19.9 (Feature Selection & Avoiding Data Leakage)
# သီအိုရီ - 'user' ကော်လံ (စမ်းသပ်ခံပုဂ္ဂိုလ်အမည်) ကို ဖယ်ရှားပစ်ရခြင်းမှာ Model သည်
# ကိုယ်ဟန်လှုပ်ရှားမှု (x1..z4) ကို သင်ယူမည့်အစား လူနာမည်နှင့် ကိုယ်အလေးချိန်ကို မှတ်သားပြီး
# ဖြတ်လမ်းနည်းဖြင့် ခန့်မှန်းခြင်း (Data Leakage / Shortcut Learning) မဖြစ်စေရန် ဖြစ်သည်။
# ==============================================================================
y_raw = X['class'].copy()
y_dummies = pd.get_dummies(y_raw, dtype=int) # TODO 5: One-Hot Dummies Encoding (5 columns)
# TODO 6: user နှင့် class ကော်လံများကို X ထဲမှ ဖယ်ရှားခြင်း
X_features = X.drop(['user', 'class'], axis=1)
# ==============================================================================
# အပိုင်း (၃) - Train / Test Split (70% Train, 30% Test) နှင့် Random Forest လေ့ကျင့်ခြင်း
# AIMA (4th Ed.) Ch. 19, Sec. 19.3 (Decision Trees) & Sec. 19.8 (Ensemble Learning: Bagging)
# သီအိုရီ -
# 1. Single Decision Tree သည် ဒေတာအနည်းငယ် ပြောင်းလဲရုံဖြင့် အကိုင်းအခက်များ ပြောင်းလဲတတ်သော
# High Variance (Overfitting) ပြဿနာ ရှိသည်။
# 2. Random Forest (Bagging + Random Feature Subspaces): Training Data မှ Bootstrap
# နမူနာများ ကျပန်းယူ၍ သစ်ပင် ၃၀ (n_estimators=30) ကို တည်ဆောက်ပြီး အကိုင်းခွဲတိုင်းတွင်
# Feature အားလုံးမသုံးဘဲ ကျပန်း Feature အချို့ (sqrt(p)) ကိုသာ ရွေးချယ်စစ်ဆေးသဖြင့်
# သစ်ပင်အချင်းချင်း ဆင်တူမှု (Correlation) နည်းပါးပြီး Generalization အလွန်ကောင်းမွန်သည်။
# 3. Out-of-Bag (OOB) Score: Bootstrap နမူနာယူရာတွင် သစ်ပင်တစ်ပင်ချင်းစီ၌ မပါဝင်ဘဲ
# ကျန်ခဲ့သော ဒေတာ (~36.8%) ကို အသုံးပြု၍ သီးခြား Validation Set မလိုဘဲ တိကျမှုကို
# အလိုအလျောက် တိုင်းတာပေးသည့် စနစ်ဖြစ်သည်။
# ==============================================================================
X_train, X_test, y_train, y_test = train_test_split(
X_features, y_dummies, test_size=0.3, random_state=7
)
# TODO 7 & 9: RandomForestClassifier တည်ဆောက်ခြင်းနှင့် လေ့ကျင့်ခြင်း
model = RandomForestClassifier(
n_estimators=30, max_depth=10, oob_score=True, random_state=0, n_jobs=-1
)
print("\n" + "=" * 75)
print("EXPERIMENT 1: Baseline Random Forest (n_estimators=30, max_depth=10, y=dummies)")
print("-" * 75)
s = time.time()
model.fit(X_train, y_train)
fit_time = time.time() - s
print(f"Fitting completed in : {fit_time:.3f} sec")
oob_acc = model.oob_score_
print(f"OOB Score : {round(oob_acc * 100, 3)}%")
s = time.time()
myPredict = model.predict(X_test)
test_acc = accuracy_score(y_test, myPredict)
score_time = time.time() - s
print(f"Test Accuracy Score : {round(test_acc * 100, 3)}% (Scored in {score_time:.3f} sec)")
# နှိုင်းယှဉ်ချက်: Single Decision Tree (max_depth=10) နှင့် ယှဉ်ကြည့်ခြင်း (AIMA Ch. 19.3 vs 19.8)
single_tree = DecisionTreeClassifier(max_depth=10, random_state=0).fit(X_train, y_train)
tree_acc = accuracy_score(y_test, single_tree.predict(X_test))
print(f"[Comparison] Single Decision Tree (max_depth=10) Test Accuracy: {round(tree_acc * 100, 3)}%")
print("=" * 75)
# ==============================================================================
# အပိုင်း (၄) - TODO Experiment A: 'gender' Column Encoding ပြောင်းလဲစမ်းသပ်ခြင်း
# AIMA (4th Ed.) Ch. 19, Sec. 19.3 & 19.9 (Monotonic Invariance in Tree Splits & Redundancy)
# သီအိုရီ - Decision Tree / Random Forest များသည် တန်ဖိုးများကို အကြီးအသေး အစဉ်လိုက်ဖြတ်တောက်
# (Threshold Splitting: x_j <= threshold) သောကြောင့် Binary Feature ကို (0,1) မှ (1,0) သို့
# ပြောင်းပြန်လှန်ရုံဖြင့် သစ်ပင်၏ ခွဲခြားနိုင်စွမ်း လုံးဝမပြောင်းလဲပါ။ ထို့အပြင် ခန္ဓာကိုယ်အရပ်၊
# အလေးချိန်၊ BMI နှင့် လှုပ်ရှားမှုအာရုံခံကိန်းဂဏန်းများ ပါဝင်ပြီးဖြစ်၍ gender ကို ဖယ်ရှားလိုက်သော်လည်း
# တိကျမှု မကျဆင်းဘဲ တည်ငြိမ်နေသည်ကို တွေ့ရမည်။
# ==============================================================================
print("\nEXPERIMENT 2 (TODO): Effect of Different 'gender' Column Encodings")
print("-" * 75)
gender_variants = {}
# 1. Original: Man=0, Woman=1
gender_variants['1. Man:0, Woman:1 (Baseline)'] = X_features.copy()
# 2. Flipped: Man=1, Woman=0
X_flip = X_features.copy()
X_flip['gender'] = 1 - X_flip['gender']
gender_variants['2. Man:1, Woman:0 (Flipped)'] = X_flip
# 3. One-Hot Dummies: gender_Man, gender_Woman
X_g_dum = pd.get_dummies(X_features, columns=['gender'], dtype=int)
gender_variants['3. pd.get_dummies(gender)'] = X_g_dum
# 4. Dropped: gender ကော်လံကို လုံးဝဖယ်ရှားခြင်း
X_no_gender = X_features.drop(['gender'], axis=1)
gender_variants['4. Dropped gender column'] = X_no_gender
for desc, X_var in gender_variants.items():
X_tr, X_te, y_tr, y_te = train_test_split(X_var, y_dummies, test_size=0.3, random_state=7)
rf = RandomForestClassifier(n_estimators=30, max_depth=10, oob_score=True, random_state=0, n_jobs=-1)
rf.fit(X_tr, y_tr)
sc = accuracy_score(y_te, rf.predict(X_te))
print(f" {desc:<30} | OOB: {rf.oob_score_*100:6.3f}% | Test Acc: {sc*100:6.3f}%")
print("=" * 75)
# ==============================================================================
# အပိုင်း (၅) - TODO Experiment B: Target 'y' Encoding ပြောင်းလဲစမ်းသပ်ခြင်း
# AIMA (4th Ed.) Ch. 19, Sec. 19.1 & 19.8 (Multiclass Probability Aggregation vs Multi-Output)
# သီအိုရီ -
# - pd.get_dummies(y) (5 binary columns): အတန်း ၅ ခုကို သီးခြားစီ ခန့်မှန်းသဖြင့်
# အတန်းတစ်ခုမျှ 0.5 မကျော်လျှင် [0,0,0,0,0] ထွက်ပြီး မှားယွင်းသည်ဟု တွက်ချက်ခံရသည်။
# - 1D Label Encoding (0..4): Random Forest သည် အတန်း ၅ ခုလုံး၏ ပျမ်းမျှဖြစ်နိုင်ခြေ
# (Class Probabilities) ကို ပေါင်းစည်း၍ အမြင့်ဆုံးအတန်း (argmax) ကို ရွေးချယ်ပေးသဖြင့်
# ပိုမိုမြင့်မားသော တိကျမှုကို ရရှိသည်။
# ==============================================================================
print("\nEXPERIMENT 3 (TODO): Effect of Target 'y' Encoding (Dummies vs. 1D Multiclass Labels)")
print("-" * 75)
le = LabelEncoder()
y_1d_encoded = le.fit_transform(y_raw) # 0='sitting', 1='sittingdown', 2='standing', 3='standingup', 4='walking'
X_tr_1d, X_te_1d, y_tr_1d, y_te_1d = train_test_split(
X_features, y_1d_encoded, test_size=0.3, random_state=7
)
rf_1d = RandomForestClassifier(n_estimators=30, max_depth=10, oob_score=True, random_state=0, n_jobs=-1)
rf_1d.fit(X_tr_1d, y_tr_1d)
y_pred_1d = rf_1d.predict(X_te_1d)
acc_1d = accuracy_score(y_te_1d, y_pred_1d)
print(f" y = pd.get_dummies(class) [Multi-Output] | OOB: {model.oob_score_*100:6.3f}% | Test Acc: {test_acc*100:6.3f}%")
print(f" y = LabelEncoder(class) [1D Multiclass]| OOB: {rf_1d.oob_score_*100:6.3f}% | Test Acc: {acc_1d*100:6.3f}%")
print("=" * 75)
# ==============================================================================
# အပိုင်း (၆) - ရလဒ်ဂရပ်ဖ် ၂ ခု ရေးဆွဲခြင်း (Confusion Matrix & Top Accelerometer Features)
# ==============================================================================
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(15, 5.8))
# ဘယ်ဘက်ဂရပ်ဖ် - Confusion Matrix (1D Multiclass Random Forest)
cm = confusion_matrix(y_te_1d, y_pred_1d)
disp = ConfusionMatrixDisplay(confusion_matrix=cm, display_labels=le.classes_)
disp.plot(ax=ax1, cmap='Blues', colorbar=False, values_format='d')
ax1.grid(False)
ax1.set_title(f'HAR Confusion Matrix (1D Label Encoded RF)\nTest Accuracy: {acc_1d*100:.2f}%',
fontsize=11.5, fontweight='bold')
# ညာဘက်ဂရပ်ဖ် - Feature Importances (Gini Impurity Reduction - AIMA Ch. 19.3)
importances = pd.Series(rf_1d.feature_importances_, index=X_features.columns).sort_values(ascending=True)
importances.plot(kind='barh', ax=ax2, color='teal')
ax2.set_title('Random Forest Feature Importances\n(Which Sensors & Body Metrics Matter Most?)',
fontsize=11.5, fontweight='bold')
ax2.set_xlabel('Mean Decrease in Gini Impurity')
plt.tight_layout()
plt.show()
ထွက်ပေါ်လာသော
ဂရပ်ဖ်နှစ်ခုသည် လူသားတို့၏ ကိုယ်ဟန်အနေအထား ၅ မျိုးကို 1D Label-Encoded Random Forest (n_estimators=30,
max_depth=10) ဖြင့်
ခွဲခြားခန့်မှန်းရာတွင်
စမ်းသပ်ဒေတာစုစုပေါင်း
49,690 ခုအနက် 48,293
ခုကို မှန်ကန်စွာ ခန့်မှန်းနိုင်ပြီး 97.19%
တိကျမှု (Test
Accuracy) ရရှိခဲ့ကြောင်း
ပြသနေပါသည်။
၁။
Confusion Matrix ခွဲခြမ်းစိတ်ဖြာချက်
(ငြိမ်သက်နေသော
အနေအထား vs. ကူးပြောင်းနေဆဲ လှုပ်ရှားမှု)
ဘယ်ဘက်ဂရပ်ဖ်ရှိ
Confusion Matrix ကို
ကိုယ်ဟန်အနေအထား တစ်ခုချင်းစီအလိုက် ခွဲခြမ်းစိတ်ဖြာကြည့်ပါက မော်ဒယ်၏ အားသာချက်နှင့် မှားယွင်းတတ်သည့် နေရာများကို အတိအကျ တွေ့ရှိရပါသည်—
ကိုယ်ဟန်အနေအထား (True Label)
စမ်းသပ်ဒေတာ စုစုပေါင်း
မှန်ကန်စွာ ခန့်မှန်းနိုင်မှု
တိကျမှု (Recall)
အဓိက မှားယွင်းခန့်မှန်းမိသည့်
အတန်း
(Confusion)
sitting (ထိုင်နေခြင်း)
15,209
15,185
99.84%
standingup (21 ကြိမ်)၊ sittingdown (3 ကြိမ်)
standing (မတ်တပ်ရပ်နေခြင်း)
14,077
14,002
99.47%
walking (70 ကြိမ်)၊ standingup (5 ကြိမ်)
walking (လမ်းလျှောက်နေခြင်း)
13,189
12,825
97.24%
standing (347 ကြိမ်)၊ sittingdown (10 ကြိမ်)
sittingdown (ထိုင်ချနေဆဲ)
3,490
3,152
90.32%
standing (237 ကြိမ်)၊ standingup (49 ကြိမ်)
standingup (ထိုင်ရာမှ ထနေဆဲ)
3,725
3,129
84.00%
standing (394 ကြိမ်)၊ sittingdown (147 ကြိမ်)
ဤဇယားမှ
အလွန်အရေးကြီးသော တွေ့ရှိချက် ၃ ခုကို ကောက်ချက်ချနိုင်ပါသည်။
- Static Postures (sitting နှင့် standing)
တွင် ၉၉.၅% နီးပါး တိကျမှု: ထိုင်နေခြင်း (99.84%)
နှင့် မတ်တပ်ရပ်နေခြင်း
(99.47%) တို့သည်
ခန္ဓာကိုယ်အနေအထား
တည်ငြိမ်နေသဖြင့်
အာရုံခံကိရိယာ တန်ဖိုးများ ပြတ်သားစွာ ကွဲပြားနေပြီး အမှားအယွင်း မရှိသလောက် နည်းပါးပါသည်။
- Transitional Movements (standingup နှင့် sittingdown)
တွင် မှားယွင်းမှု အများဆုံး ဖြစ်ပေါ်ခြင်း:
- standingup (ထိုင်ရာမှ
ထနေဆဲ) ၏ မှားယွင်းမှု အများစုမှာ standing
(394 ကြိမ်)
နှင့်
sittingdown (147 ကြိမ်)
တို့ ဖြစ်နေပြီး၊
sittingdown (ထိုင်ချနေဆဲ)
၏ မှားယွင်းမှု အများစုမှာလည်း
standing (237 ကြိမ်)
ဖြစ်နေပါသည်။
- ရူပဗေဒ
အကြောင်းရင်း:
လူတစ်ဦး ထိုင်ရာမှ ထလိုက်ချိန်
(standingup) နှင့်
ထိုင်ချလိုက်ချိန်
(sittingdown) တို့သည်
အလယ်အလတ် ခါးကုန်း/ဒူးကွေး အနေအထား
(Intermediate Angles) တူညီသော
နေရာများကို အပြန်အလှန် ဖြတ်သန်းရသည့်အပြင် စတင်ချိန်နှင့် ပြီးဆုံးချိန်တို့တွင်
မတ်တပ်ရပ်နေသည့်
အနေအထား
(standing) နှင့်
ဆက်စပ်နေသောကြောင့်
ဖြစ်ပါသည်။
- Class Imbalance (AIMA Ch. 19, Sec. 19.2 &
19.9): ထို့အပြင်
sitting (15,209 ခု)
နှင့် standing
(14,077 ခု) တို့သည် sittingdown
(3,490 ခု) နှင့် standingup
(3,725 ခု) တို့ထက် ဒေတာအရေအတွက် ၄ ဆခန့် ပိုများနေသဖြင့် မသေချာသော နယ်နိမိတ်အမှတ်များတွင်
Random Forest က
အရေအတွက် များသော standing ဘက်သို့ ပိုမိုခန့်မှန်းမိခြင်း
ဖြစ်ပါသည်။
- walking နှင့်
standing ကြား
မှားယွင်းမှု
(347 ကြိမ်):
လမ်းလျှောက်နေစဉ်
ခြေတစ်ဖက် မြေပြင်ပေါ် ထောက်၍ ခန္ဓာကိုယ် မတ်မတ်ဖြစ်သွားသည့် အခိုက်အတန့်
(Single-Support Stance Phase) တွင်
အာရုံခံကိရိယာ တန်ဖိုးများသည် မတ်တပ်ရပ်နေသည့် အနေအထားနှင့် ခေတ္တတူညီသွားသောကြောင့်
standing အဖြစ် မှားယွင်းခန့်မှန်းခံရခြင်း
ဖြစ်ပါသည်။
၂။
Feature Importances နှင့်
ခန္ဓာကိုယ်ဇီဝမက္ကင်းနစ်
(Biomechanics) ဆက်စပ်မှု
ညာဘက်ဂရပ်ဖ်
(Random Forest Feature Importances — Mean Decrease in Gini Impurity) သည် AIMA Chapter 19,
Section 19.3 ပါ
Decision Tree ၏ အချက်အလက်ရရှိမှု
(Information Gain / Gini Reduction) သီအိုရီကို
ခန္ဓာကိုယ် အာရုံခံကိရိယာ တည်နေရာများနှင့် တိုက်ရိုက် ချိတ်ဆက်ပြသနေပါသည်။
PUC-Rio Dataset တွင် အာရုံခံကိရိယာ
(Accelerometer) ၄ ခုကို ခန္ဓာကိုယ် အစိတ်အပိုင်း ၄ နေရာ၌ တပ်ဆင်ထားပါသည်။
- Sensor 1 (x1, y1, z1): ခါး (Waist)
- Sensor 2 (x2, y2, z2): ဘယ်ဘက် ပေါင် (Left Thigh)
- Sensor 3 (x3, y3, z3): ညာဘက် ခြေကျင်းဝတ် (Right
Ankle)
- Sensor 4 (x4, y4, z4): ညာဘက် လက်မောင်း (Right
Upper Arm)
ဂရပ်ဖ်ထဲရှိ
အရေးပါမှု အစီအစဉ်ကို ကြည့်ပါက အောက်ပါအတိုင်း ယုတ္တိရှိရှိ စီတန်းနေသည်ကို တွေ့ရပါသည်။
- ထိပ်ဆုံး
အရေးအပါဆုံး
Sensor ဝင်ရိုး
၄ ခု (z1, z2,
y3, y2):
- z1 (ခါး
Z-ဝင်ရိုး
— ~0.187) သည်
အခြား Feature အားလုံးထက် သိသိသာသာ အရေးအပါဆုံး ဖြစ်နေပြီး၊ ၎င်းနောက်တွင် z2
(ဘယ်ဘက်ပေါင်
Z-ဝင်ရိုး
— ~0.126)၊
y3 (ညာဘက်ခြေကျင်းဝတ်
Y-ဝင်ရိုး
— ~0.123) နှင့်
y2 (ဘယ်ဘက်ပေါင်
Y-ဝင်ရိုး
— ~0.116) တို့
ကပ်လိုက်နေပါသည်။
- ဇီဝမက္ကင်းနစ်
အကြောင်းရင်း:
လူတစ်ဦး မတ်တပ်ရပ်နေရာမှ ထိုင်ချလိုက်သောအခါ ခါး (z1) နှင့် ပေါင်တံ (z2, y2) တို့သည် ကမ္ဘာ့ဆွဲငင်အား
(Gravity) နှင့်
နှိုင်းယှဉ်လျှင်
၉၀ ဒီဂရီ (ဒေါင်လိုက်မှ ရေပြင်ညီသို့) ပြောင်းလဲသွားပါသည်။ ထို့ကြောင့် z1 နှင့် z2 တန်ဖိုးများသည် ထိုင်ခြင်းနှင့် ရပ်ခြင်းကို အပြတ်သားဆုံး ပိုင်းခြားပေးနိုင်ပါသည်။
ထို့အတူ ခြေကျင်းဝတ် (y3) သည် လမ်းလျှောက်ရာတွင် ခြေထောက်လွှဲသည့် အရှိန်ကို ဖမ်းယူနိုင်သဖြင့်
walking နှင့်
standing ကို ခွဲခြားရာတွင် အဓိကကျပါသည်။
- အောက်ဆုံး
အရေးပါမှု
အနည်းဆုံး
၅ ခု (Body Metrics
နှင့် gender):
- ဂရပ်ဖ်၏
အောက်ခြေဆုံး ၅ နေရာတွင်
body_mass_index, weight, how_tall_in_meters, age နှင့် gender (~0.006 — အနည်းဆုံး) တို့ ရှိနေပါသည်။
- သီအိုရီ
အတည်ပြုချက်:
လူတစ်ဦး ထိုင်ရာမှ ထလိုက်သည်ဖြစ်စေ၊ လမ်းလျှောက်သည်ဖြစ်စေ
၎င်း၏ အသက်၊ အရပ်၊ ကိုယ်အလေးချိန်နှင့် ကျား/မ ဖြစ်မှုတို့မှာ ပြောင်းလဲသွားခြင်း မရှိပါ။ ထို့ကြောင့် ယခင် Experiment 2 တွင် gender ကော်လံကို လုံးဝဖယ်ရှားပစ်ခဲ့သော်လည်း
တိကျမှု မကျဆင်းခဲ့ခြင်းမှာ ၎င်း၏ Gini
Importance သည်
0.006 ခန့်သာ ရှိသောကြောင့် ဖြစ်ကြောင်း ဤဂရပ်ဖ်က မျက်မြင်သက်သေ ပြသနေပါသည်။
၃။
AIMA သီအိုရီအရ
တိကျမှု 99%+
အထိ ထပ်မံမြှင့်တင်နိုင်မည့် နည်းလမ်း
ယခု
Random Forest မော်ဒယ်သည်
အချိန်မှတ်တမ်း တစ်ကြောင်းချင်းစီ (t) ကို သီးခြားစီ ကြည့်ရှုခန့်မှန်းခြင်း (i.i.d.
Static Snapshot Assumption) ဖြစ်သောကြောင့်
ခါးတစ်ဝက်ကုန်းနေသည့်
အခိုက်အတန့်တွင် ထိုသူသည် ထိုင်ချနေဆဲ (sittingdown)
လား သို့မဟုတ် ထိုင်ရာမှ ထနေဆဲ (standingup)
လား ဆိုသည်ကို ခွဲခြားရန် ခက်ခဲနေခြင်း ဖြစ်ပါသည်။
Chapter 14 (Probabilistic Reasoning over Time) နှင့် Chapter 22, Section 22.5 (Recurrent
Networks / 1D-CNNs) တို့အရ
ယခင် 0.5 စက္ကန့်အတွင်းရှိ Sensor ပြောင်းလဲနှုန်း (Temporal
Derivatives:
နှင့်
Rolling Standard Deviation) ကို
Feature အသစ်အဖြစ် ထည့်သွင်းပေးခြင်း သို့မဟုတ် 1D-CNN / GRU
ဖြင့် အချိန်အလိုက် ဆက်စပ်သင်ကြားပေးခြင်းဖြင့်
standingup နှင့်
sittingdown ကြား မှားယွင်းမှုများကို ဖယ်ရှားနိုင်ပြီး တိကျမှုကို 99% အထက်သို့ မြှင့်တင်နိုင်မည် ဖြစ်ပါသည်။
ထွက်ပေါ်လာသော ဂရပ်ဖ်နှစ်ခုသည် လူသားတို့၏ ကိုယ်ဟန်အနေအထား ၅ မျိုးကို 1D Label-Encoded Random Forest (n_estimators=30, max_depth=10) ဖြင့် ခွဲခြားခန့်မှန်းရာတွင် စမ်းသပ်ဒေတာစုစုပေါင်း 49,690 ခုအနက် 48,293 ခုကို မှန်ကန်စွာ ခန့်မှန်းနိုင်ပြီး 97.19% တိကျမှု (Test Accuracy) ရရှိခဲ့ကြောင်း ပြသနေပါသည်။
၁။
Confusion Matrix ခွဲခြမ်းစိတ်ဖြာချက်
(ငြိမ်သက်နေသော
အနေအထား vs. ကူးပြောင်းနေဆဲ လှုပ်ရှားမှု)
ဘယ်ဘက်ဂရပ်ဖ်ရှိ
Confusion Matrix ကို
ကိုယ်ဟန်အနေအထား တစ်ခုချင်းစီအလိုက် ခွဲခြမ်းစိတ်ဖြာကြည့်ပါက မော်ဒယ်၏ အားသာချက်နှင့် မှားယွင်းတတ်သည့် နေရာများကို အတိအကျ တွေ့ရှိရပါသည်—
|
ကိုယ်ဟန်အနေအထား (True Label) |
စမ်းသပ်ဒေတာ စုစုပေါင်း |
မှန်ကန်စွာ ခန့်မှန်းနိုင်မှု |
တိကျမှု (Recall) |
အဓိက မှားယွင်းခန့်မှန်းမိသည့်
အတန်း
(Confusion) |
|
sitting (ထိုင်နေခြင်း) |
15,209 |
15,185 |
99.84% |
standingup (21 ကြိမ်)၊ sittingdown (3 ကြိမ်) |
|
standing (မတ်တပ်ရပ်နေခြင်း) |
14,077 |
14,002 |
99.47% |
walking (70 ကြိမ်)၊ standingup (5 ကြိမ်) |
|
walking (လမ်းလျှောက်နေခြင်း) |
13,189 |
12,825 |
97.24% |
standing (347 ကြိမ်)၊ sittingdown (10 ကြိမ်) |
|
sittingdown (ထိုင်ချနေဆဲ) |
3,490 |
3,152 |
90.32% |
standing (237 ကြိမ်)၊ standingup (49 ကြိမ်) |
|
standingup (ထိုင်ရာမှ ထနေဆဲ) |
3,725 |
3,129 |
84.00% |
standing (394 ကြိမ်)၊ sittingdown (147 ကြိမ်) |
ဤဇယားမှ အလွန်အရေးကြီးသော တွေ့ရှိချက် ၃ ခုကို ကောက်ချက်ချနိုင်ပါသည်။
- Static Postures (sitting နှင့် standing)
တွင် ၉၉.၅% နီးပါး တိကျမှု: ထိုင်နေခြင်း (99.84%)
နှင့် မတ်တပ်ရပ်နေခြင်း
(99.47%) တို့သည်
ခန္ဓာကိုယ်အနေအထား
တည်ငြိမ်နေသဖြင့်
အာရုံခံကိရိယာ တန်ဖိုးများ ပြတ်သားစွာ ကွဲပြားနေပြီး အမှားအယွင်း မရှိသလောက် နည်းပါးပါသည်။
- Transitional Movements (standingup နှင့် sittingdown)
တွင် မှားယွင်းမှု အများဆုံး ဖြစ်ပေါ်ခြင်း:
- standingup (ထိုင်ရာမှ
ထနေဆဲ) ၏ မှားယွင်းမှု အများစုမှာ standing
(394 ကြိမ်)
နှင့်
sittingdown (147 ကြိမ်)
တို့ ဖြစ်နေပြီး၊
sittingdown (ထိုင်ချနေဆဲ)
၏ မှားယွင်းမှု အများစုမှာလည်း
standing (237 ကြိမ်)
ဖြစ်နေပါသည်။
- ရူပဗေဒ
အကြောင်းရင်း:
လူတစ်ဦး ထိုင်ရာမှ ထလိုက်ချိန်
(standingup) နှင့်
ထိုင်ချလိုက်ချိန်
(sittingdown) တို့သည်
အလယ်အလတ် ခါးကုန်း/ဒူးကွေး အနေအထား
(Intermediate Angles) တူညီသော
နေရာများကို အပြန်အလှန် ဖြတ်သန်းရသည့်အပြင် စတင်ချိန်နှင့် ပြီးဆုံးချိန်တို့တွင်
မတ်တပ်ရပ်နေသည့်
အနေအထား
(standing) နှင့်
ဆက်စပ်နေသောကြောင့်
ဖြစ်ပါသည်။
- Class Imbalance (AIMA Ch. 19, Sec. 19.2 &
19.9): ထို့အပြင်
sitting (15,209 ခု)
နှင့် standing
(14,077 ခု) တို့သည် sittingdown
(3,490 ခု) နှင့် standingup
(3,725 ခု) တို့ထက် ဒေတာအရေအတွက် ၄ ဆခန့် ပိုများနေသဖြင့် မသေချာသော နယ်နိမိတ်အမှတ်များတွင်
Random Forest က
အရေအတွက် များသော standing ဘက်သို့ ပိုမိုခန့်မှန်းမိခြင်း
ဖြစ်ပါသည်။
- walking နှင့်
standing ကြား
မှားယွင်းမှု
(347 ကြိမ်):
လမ်းလျှောက်နေစဉ်
ခြေတစ်ဖက် မြေပြင်ပေါ် ထောက်၍ ခန္ဓာကိုယ် မတ်မတ်ဖြစ်သွားသည့် အခိုက်အတန့်
(Single-Support Stance Phase) တွင်
အာရုံခံကိရိယာ တန်ဖိုးများသည် မတ်တပ်ရပ်နေသည့် အနေအထားနှင့် ခေတ္တတူညီသွားသောကြောင့်
standing အဖြစ် မှားယွင်းခန့်မှန်းခံရခြင်း
ဖြစ်ပါသည်။
၂။
Feature Importances နှင့်
ခန္ဓာကိုယ်ဇီဝမက္ကင်းနစ်
(Biomechanics) ဆက်စပ်မှု
ညာဘက်ဂရပ်ဖ်
(Random Forest Feature Importances — Mean Decrease in Gini Impurity) သည် AIMA Chapter 19,
Section 19.3 ပါ
Decision Tree ၏ အချက်အလက်ရရှိမှု
(Information Gain / Gini Reduction) သီအိုရီကို
ခန္ဓာကိုယ် အာရုံခံကိရိယာ တည်နေရာများနှင့် တိုက်ရိုက် ချိတ်ဆက်ပြသနေပါသည်။
- Sensor 1 (x1, y1, z1): ခါး (Waist)
- Sensor 2 (x2, y2, z2): ဘယ်ဘက် ပေါင် (Left Thigh)
- Sensor 3 (x3, y3, z3): ညာဘက် ခြေကျင်းဝတ် (Right
Ankle)
- Sensor 4 (x4, y4, z4): ညာဘက် လက်မောင်း (Right
Upper Arm)
ဂရပ်ဖ်ထဲရှိ အရေးပါမှု အစီအစဉ်ကို ကြည့်ပါက အောက်ပါအတိုင်း ယုတ္တိရှိရှိ စီတန်းနေသည်ကို တွေ့ရပါသည်။
- ထိပ်ဆုံး
အရေးအပါဆုံး
Sensor ဝင်ရိုး
၄ ခု (z1, z2,
y3, y2):
- z1 (ခါး
Z-ဝင်ရိုး
— ~0.187) သည်
အခြား Feature အားလုံးထက် သိသိသာသာ အရေးအပါဆုံး ဖြစ်နေပြီး၊ ၎င်းနောက်တွင် z2
(ဘယ်ဘက်ပေါင်
Z-ဝင်ရိုး
— ~0.126)၊
y3 (ညာဘက်ခြေကျင်းဝတ်
Y-ဝင်ရိုး
— ~0.123) နှင့်
y2 (ဘယ်ဘက်ပေါင်
Y-ဝင်ရိုး
— ~0.116) တို့
ကပ်လိုက်နေပါသည်။
- ဇီဝမက္ကင်းနစ်
အကြောင်းရင်း:
လူတစ်ဦး မတ်တပ်ရပ်နေရာမှ ထိုင်ချလိုက်သောအခါ ခါး (z1) နှင့် ပေါင်တံ (z2, y2) တို့သည် ကမ္ဘာ့ဆွဲငင်အား
(Gravity) နှင့်
နှိုင်းယှဉ်လျှင်
၉၀ ဒီဂရီ (ဒေါင်လိုက်မှ ရေပြင်ညီသို့) ပြောင်းလဲသွားပါသည်။ ထို့ကြောင့် z1 နှင့် z2 တန်ဖိုးများသည် ထိုင်ခြင်းနှင့် ရပ်ခြင်းကို အပြတ်သားဆုံး ပိုင်းခြားပေးနိုင်ပါသည်။
ထို့အတူ ခြေကျင်းဝတ် (y3) သည် လမ်းလျှောက်ရာတွင် ခြေထောက်လွှဲသည့် အရှိန်ကို ဖမ်းယူနိုင်သဖြင့်
walking နှင့်
standing ကို ခွဲခြားရာတွင် အဓိကကျပါသည်။
- အောက်ဆုံး
အရေးပါမှု
အနည်းဆုံး
၅ ခု (Body Metrics
နှင့် gender):
- ဂရပ်ဖ်၏
အောက်ခြေဆုံး ၅ နေရာတွင်
body_mass_index, weight, how_tall_in_meters, age နှင့် gender (~0.006 — အနည်းဆုံး) တို့ ရှိနေပါသည်။
- သီအိုရီ
အတည်ပြုချက်:
လူတစ်ဦး ထိုင်ရာမှ ထလိုက်သည်ဖြစ်စေ၊ လမ်းလျှောက်သည်ဖြစ်စေ
၎င်း၏ အသက်၊ အရပ်၊ ကိုယ်အလေးချိန်နှင့် ကျား/မ ဖြစ်မှုတို့မှာ ပြောင်းလဲသွားခြင်း မရှိပါ။ ထို့ကြောင့် ယခင် Experiment 2 တွင် gender ကော်လံကို လုံးဝဖယ်ရှားပစ်ခဲ့သော်လည်း
တိကျမှု မကျဆင်းခဲ့ခြင်းမှာ ၎င်း၏ Gini
Importance သည်
0.006 ခန့်သာ ရှိသောကြောင့် ဖြစ်ကြောင်း ဤဂရပ်ဖ်က မျက်မြင်သက်သေ ပြသနေပါသည်။
၃။
AIMA သီအိုရီအရ
တိကျမှု 99%+
အထိ ထပ်မံမြှင့်တင်နိုင်မည့် နည်းလမ်း
ယခု
Random Forest မော်ဒယ်သည်
အချိန်မှတ်တမ်း တစ်ကြောင်းချင်းစီ (t) ကို သီးခြားစီ ကြည့်ရှုခန့်မှန်းခြင်း (i.i.d.
Static Snapshot Assumption) ဖြစ်သောကြောင့်
ခါးတစ်ဝက်ကုန်းနေသည့်
အခိုက်အတန့်တွင် ထိုသူသည် ထိုင်ချနေဆဲ (sittingdown)
လား သို့မဟုတ် ထိုင်ရာမှ ထနေဆဲ (standingup)
လား ဆိုသည်ကို ခွဲခြားရန် ခက်ခဲနေခြင်း ဖြစ်ပါသည်။
