Python (log၊ square root၊ cube root) တွင်ဒေတာကိုဘယ်လိုပြောင်းမလဲ


ကိန်းဂဏန်းစစ်ဆေးမှုများစွာသည် ဒေတာအစုံများကို ပုံမှန်ဖြန့်ဝေသည်ဟု ယူဆသည်။ သို့သော် လက်တွေ့တွင် ထိုသို့ဖြစ်လေ့မရှိပေ။

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

1. မှတ်တမ်းအသွင်ပြောင်းခြင်း- တုံ့ပြန်မှုကိန်းရှင်ကို y မှ log(y) သို့ ပြောင်းလဲပါ။

2. စတုရန်းအမြစ်အသွင်ပြောင်းခြင်း- တုံ့ပြန်မှုကိန်းရှင်ကို y မှ √y သို့ ပြောင်းလဲပါ။

3. Cube root အသွင်ပြောင်းခြင်း- တုံ့ပြန်မှု variable ကို y မှ y 1/3 သို့ပြောင်းပါ။

ဤအသွင်ပြောင်းမှုများကို လုပ်ဆောင်ခြင်းဖြင့် ဒေတာအတွဲသည် ယေဘူယျအားဖြင့် ပိုမိုပုံမှန်အတိုင်း ဖြန့်ဝေလာပါသည်။

အောက်ပါဥပမာများသည် Python တွင် ဤအသွင်ပြောင်းမှုများကို မည်သို့လုပ်ဆောင်ရမည်ကို ပြသထားသည်။

Python တွင် Transform ကိုဝင်ရောက်ပါ။

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

 import numpy as np
import matplotlib. pyplot as plt

#make this example reproducible
n.p. random . seeds (0)

#create beta distributed random variable with 200 values
data = np. random . beta (a= 4 , b= 15 , size= 300 )

#create log-transformed data
data_log = np. log (data)

#define grid of plots
fig, axs = plt. subplots (nrows= 1 , ncols= 2 )

#create histograms
axs[0]. hist (data, edgecolor=' black ')
axs[1]. hist (data_log, edgecolor=' black ')

#add title to each histogram
axs[0]. set_title (' Original Data ')
axs[1].set_title(' Log-Transformed Data ')

မှတ်တမ်းပုံစံပြောင်းထားသော ဖြန့်ဝေမှုသည် မူရင်းဖြန့်ဖြူးမှုထက် ပိုမိုပုံမှန်ဖြန့်ဝေပုံကို သတိပြုပါ။

၎င်းသည် ပြီးပြည့်စုံသော “ ခေါင်းလောင်းပုံသဏ္ဍာန်” မဟုတ်သေးသော်လည်း ၎င်းသည် မူရင်းဖြန့်ဖြူးမှုထက် ပုံမှန်ဖြန့်ဖြူးမှုနှင့် ပိုမိုနီးစပ်ပါသည်။

Python တွင် Square Root အသွင်ပြောင်းခြင်း။

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

 import numpy as np
import matplotlib. pyplot as plt

#make this example reproducible
n.p. random . seeds (0)

#create beta distributed random variable with 200 values
data = np. random . beta (a= 1 , b= 5 , size= 300 )

#create log-transformed data
data_log = np. sqrt (data)

#define grid of plots
fig, axs = plt. subplots (nrows= 1 , ncols= 2 )

#create histograms
axs[0]. hist (data, edgecolor=' black ')
axs[1]. hist (data_log, edgecolor=' black ')

#add title to each histogram
axs[0]. set_title (' Original Data ')
axs[1].set_title(' Square Root Transformed Data ') 

ဒေတာနှစ်ထပ်ကိန်းကို မူလဒေတာထက် ပုံမှန်အားဖြင့် ပိုမိုဖြန့်ဝေပုံကို သတိပြုပါ။

Python တွင် Cube Root အသွင်ပြောင်းခြင်း။

အောက်ပါကုဒ်သည် ကိန်းရှင်တစ်ခုပေါ်တွင် cube root အသွင်ပြောင်းခြင်းကို မည်သို့လုပ်ဆောင်ရမည်ကို ပြသပြီး မူရင်းဖြန့်ဖြူးမှုကိုပြသရန်နှင့် ဒေတာ၏ cube root အသွင်ပြောင်းဖြန့်ဖြူးမှုကို ပြသရန် ဘေးချင်းကပ်ကွက်များကို ဖန်တီးသည်-

 import numpy as np
import matplotlib. pyplot as plt

#make this example reproducible
n.p. random . seeds (0)

#create beta distributed random variable with 200 values
data = np. random . beta (a= 1 , b= 5 , size= 300 )

#create log-transformed data
data_log = np. cbrt (data)

#define grid of plots
fig, axs = plt. subplots (nrows= 1 , ncols= 2 )

#create histograms
axs[0]. hist (data, edgecolor=' black ')
axs[1]. hist (data_log, edgecolor=' black ')

#add title to each histogram
axs[0]. set_title (' Original Data ')
axs[1].set_title(' Cube Root Transformed Data ') 

cube root သည် ဒေတာကို မူရင်းဒေတာထက် ပုံမှန်အားဖြင့် ပိုမိုဖြန့်ဝေပုံကို သတိပြုပါ။

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

Python တွင် Z ရမှတ်များကို တွက်ချက်နည်း
Python တွင်ဒေတာကိုပုံမှန်ဖြစ်အောင်လုပ်နည်း
ကိန်းဂဏန်းစာရင်းအင်းများတွင် ပုံမှန်ဖြစ်ရိုးဖြစ်စဉ်ဟူသည် အဘယ်နည်း။

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

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