Gen Cherry Lab

Gen Cherry Lab

Share

Machine Learning & AI engineering

15/09/2025

multidimensional array ဆိုတာဘာလဲ။ 🎲

python code ကို အသုံးပြုပြီးရှင်းပြပေးပါမယ်။ သို့သော် python programming မှာ built in array data type မရှိသောကြောင့် array နှင့် အဆင်တူသော list data type နှင့်ရှင်းပြပေးပါမယ်။ နောက် သင်ခန်းစားတွေ မှာတော့ NumPy library ၏ ndarray data type ကိုအသုံးပြုသွားပါမယ်။

ပထမဦးဆုံး
one dimensional array အကြောင်းပြောရအောင်
one dimensional array ဆိုတာ ရိုးရှင်းတဲ့ linear list တစ်ခုဖြစ်ပါတယ်။ array element တွေ ကို တန်းစီပြီး သိမ်းထားမှာပါ။
example
x = [1,2,3] # 1 layer

multidimensional array မှာတော့ objects အရေအတွက် (layer အရေအတွက်) n တန်ဖိုးသည်အနည်းဆုံး နှစ်ခုက ရှိရပါမယ်။ (n>=2) ဖြစ်ရပါမယ်။
example
layer = 3
x = [
[ # Layer 1
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
],
[ # Layer 2
[10, 11, 12],
[13, 14, 15],
[16, 17, 18]
],
[ # Layer 3
[19, 20, 21],
[22, 23, 24],
[25, 26, 27]
]
]

ကြည့်ရတာရှုပ်မယ်ဆိုရင် ဒီလိုလေး ကြည့်ကြည့် ကြမယ်။
Layer 0: Layer 1: Layer 2:
[1, 2, 3] [10,11,12] [19,20,21]
[4, 5, 6] [13,14,15] [22,23,24]
[7, 8, 9] [16,17,18] [25,26,27]

plz remember, index number is called from “0”

ဒီလိုဆိုရင် layer 3 ခု ၊ row 3 ခု ၊ column ခု ရှိတဲ့ array ဆိုတာသိနိုင်ပါတယ်။ ( 3 x 3 x 3)

ဒါဆို multidimensional array အကြောင်း တီးခေါက်မိပြီထင်ပါတယ်။

ဆက်ပြီး ဘာလို့ ......

🔹multidimensional array တွေကို ဘာလို့ အသုံးပြုကြပါသလဲ ..........

သိမ်းချင်တဲ့ data တွေကို structure အလိုက် သိမ်းထားနိုင်တာက အားသာချက်ပါ ။ layer တွေအလိုက် indexing နဲ့ အလွယ်တကူ access ရယူနိုင်ပါတယ်။
memory နှင့် performance အပိုင်းမှာလဲ ပီုပြီး optimize ဖြစ်လို့ အကျိူးရှိပါတယ်။ ဒီအတွက်
Mathematical operation တွေ ( matrix multiplication, image processing, statical operations) တွေမှာလဲ လျင်မြန်စွာ အလုပ်လုပ်နိုင်ပါတယ်။ Complex ဖြစ်တဲ့ data structure တွေကို handle လုပ်နိုင်ပါတယ် (ဥပမာ - Grayscale image -> 2D array (height × width) , RGB image -> 3D array (height × width × color channels) )။ အများဆုံးတွေ့နိုင်တဲ့ နေရာတွေက Simulation, Physics, Engineering, Machine Learning နယ်ပယ် တို့လို့ data structure ရှုပ်တတ်သော နေရာများမှာ တွေ့ နိုင်ပါတယ်။

Key Note : လက်ရှိသည် python list data type နှင့်တာ အသုံးပြုထားတာဖြစ်သောကြောင့် dynamic size ဖြစ်မှာပါ။ list element တွေကို ပြောင်းလဲလို့ရပါသေးတယ် ။ NumPy ၏ ndarray မှာတော့ dynamic size မဖြစ်နိုင်ပါ။ Contiguous and memory fixed size ဖြစ်တာကြောင့် သာမန် list data type ထက် ပိုမြန်ပါလိမ့်မယ်။ array element တွေကို ပြောင်းလဲလို့မရတော့ပါ။

နောက် content တွင် array data type နှင့် list data type memory ပေါ် တွင် နေရာယူ အလုပ်လုပ်ပုံကို ဖော်ပြပေးပါမည်။

Want your public figure to be the top-listed Public Figure in Yangon?
Click here to claim your Sponsored Listing.

Category

Telephone

Website

Address


Yangon