Python ရှိ စာရင်းတစ်ခု၏ စံသွေဖည်မှုကို တွက်ချက်နည်း


Python ရှိ စာရင်းတစ်ခု၏ စံသွေဖည်မှုကို တွက်ချက်ရန် အောက်ပါနည်းလမ်းသုံးမျိုးထဲမှ တစ်ခုကို သင်အသုံးပြုနိုင်သည်-

နည်းလမ်း 1- NumPy စာကြည့်တိုက်ကို အသုံးပြုပါ။

 import numpy as np

#calculate standard deviation of list
n.p. std ( my_list )

နည်းလမ်း 2- စာရင်းအင်းစာကြည့်တိုက်ကို အသုံးပြုပါ။

 import statistics as stat

#calculate standard deviation of list
stat. stdev ( my_list )

နည်းလမ်း 3- စိတ်ကြိုက်ဖော်မြူလာကို အသုံးပြုပါ။

 #calculate standard deviation of list
st. stdev ( my_list )

အောက်ဖော်ပြပါ ဥပမာများသည် ဤနည်းလမ်းတစ်ခုစီကို လက်တွေ့အသုံးချနည်းကို ပြသထားသည်။

နည်းလမ်း 1- NumPy Library ကို အသုံးပြု၍ Standard Deviation ကို တွက်ချက်ပါ။

အောက်ပါကုဒ်သည် NumPy ကို အသုံးပြု၍ စာရင်းတစ်ခု၏ နမူနာစံသွေဖည်မှုနှင့် လူဦးရေစံသွေဖည်မှုကို တွက်ချက်နည်းကို ပြသသည်-

 import numpy as np

#define list
my_list = [3, 5, 5, 6, 7, 8, 13, 14, 14, 17, 18]

#calculate sample standard deviation of list
n.p. std ( my_list, ddof= 1 )

5.310367218940701

#calculate population standard deviation of list 
n.p. std ( my_list )

5.063236478416116

လူဦးရေစံသွေဖည်မှုသည် ပေးထားသောဒေတာအစုံအတွက် နမူနာစံသွေဖည်မှုထက် အမြဲလျော့နည်းနေမည်ကို သတိပြုပါ။

နည်းလမ်း 2- Statistics Library ကို အသုံးပြု၍ Standard Deviation ကို တွက်ချက်ပါ။

အောက်ပါကုဒ်သည် နမူနာစံသွေဖည်မှုနှင့် Python စာရင်းအင်းဇယားစာကြည့်တိုက်ကို အသုံးပြု၍ စာရင်းတစ်ခု၏ လူဦးရေစံသွေဖည်မှုကို မည်သို့တွက်ချက်ရမည်ကို ပြသသည်-

 import statistics as stat

#define list
my_list = [3, 5, 5, 6, 7, 8, 13, 14, 14, 17, 18]

#calculate sample standard deviation of list
stat. stdev (my_list)

5.310367218940701

#calculate population standard deviation of list 
stat. pstdev (my_list)

5.063236478416116

နည်းလမ်း 3- စိတ်ကြိုက်ဖော်မြူလာကို အသုံးပြု၍ Standard Deviation ကို တွက်ချက်ပါ။

အောက်ပါကုဒ်သည် နမူနာစံသွေဖည်မှုနှင့် Python စာကြည့်တိုက်များကို မတင်သွင်းဘဲ စာရင်းတစ်ခု၏ လူဦးရေစံသွေဖည်မှုကို တွက်ချက်နည်းကို ပြသသည်-

 #define list
my_list = [3, 5, 5, 6, 7, 8, 13, 14, 14, 17, 18]

#calculate sample standard deviation of list
(sum((x-(sum(my_list) / len(my_list))) ** 2 for x in my_list) / (len(my_list)-1)) ** 0.5

5.310367218940701

#calculate population standard deviation of list 
(sum((x-(sum(my_list) / len(my_list))) ** 2 for x in my_list) / len(my_list)) ** 0.5

5.063236478416116

နည်းလမ်းသုံးခုစလုံးသည် စာရင်းစံသွေဖည်မှုအတွက် တူညီသောတန်ဖိုးများကို တွက်ချက်ကြောင်း သတိပြုပါ။

ထပ်လောင်းအရင်းအမြစ်များ

Python ရှိ mean ၏ standard error ကို တွက်နည်း
Python တွင် Mean Square Error (MSE) ကို တွက်ချက်နည်း

မှတ်ချက်တစ်ခုထည့်ပါ။

သင့် email လိပ်စာကို ဖော်ပြမည် မဟုတ်ပါ။ လိုအပ်သော ကွက်လပ်များကို * ဖြင့်မှတ်သားထားသည်