99999久久久久久亚洲,欧美人与禽猛交狂配,高清日韩av在线影院,一个人在线高清免费观看,啦啦啦在线视频免费观看www

熱線電話:13121318867

登錄
首頁(yè)大數(shù)據(jù)時(shí)代數(shù)據(jù)處理中,偏態(tài)數(shù)據(jù)如何正態(tài)化?
數(shù)據(jù)處理中,偏態(tài)數(shù)據(jù)如何正態(tài)化?
2020-07-17
收藏

數(shù)據(jù)處理過(guò)程中,經(jīng)常會(huì)遇到偏態(tài)數(shù)據(jù)。我們都知道數(shù)據(jù)整體服從正態(tài)分布,那樣本均值和方差則相互獨(dú)立。因此大家都會(huì)希望數(shù)據(jù)事成正態(tài)分布的,但是現(xiàn)實(shí)情況卻是:大多數(shù)情況下,數(shù)據(jù)都是偏態(tài)分布的,這時(shí)候就需要我們將偏態(tài)數(shù)據(jù)正態(tài)化。今天,小編跟大家分享的就是將偏態(tài)數(shù)據(jù)正態(tài)化的處理方法,希望對(duì)大家研究和學(xué)習(xí)偏態(tài)數(shù)據(jù)有所幫助。

一、正態(tài)分布偏態(tài)分布

首先我們先來(lái)了解一下什么是正態(tài)分布,什么是偏態(tài)分布。

由圖中可知,正態(tài)分布,兩頭低,中間高,整個(gè)形態(tài)是對(duì)稱鐘形的一個(gè)分布的狀態(tài)。大量連續(xù)數(shù)據(jù)測(cè)量時(shí),我們最希望的就是數(shù)據(jù)可以成這種狀態(tài),也就是正態(tài)分布,一個(gè)標(biāo)準(zhǔn)的正態(tài)分布是u(均值)=0.σ(標(biāo)準(zhǔn)差)=1.

橫坐標(biāo)代表隨機(jī)變量X的一個(gè)取值,在均值(u=0)附近概率密度最大,越偏離均值,概率密度減小,不在(u-3σ,u+3σ)范圍內(nèi)的數(shù)據(jù)就屬于統(tǒng)計(jì)學(xué)意義上的異常值了。

根據(jù)圖中可以看出,偏態(tài)分布,分為兩種情況,左偏又叫負(fù)偏態(tài),以及右偏又叫正偏態(tài),也可以用偏度來(lái)表示,偏度>0.也就是頻數(shù)分布的高峰向左偏移,呈右(正)偏態(tài)分布;偏度<0.即頻數(shù)分布的高峰向右偏移,呈左(負(fù))偏態(tài)分布;|偏度|>1.呈高度偏態(tài),0.5<|偏度|<1.呈中等偏態(tài)。

二、檢驗(yàn)數(shù)據(jù)是否服從正態(tài)分布


rom scipy.stats import norm
sns.distplot(train['SalePrice'],fit=norm)
#均值和方差
(mu,sigma) = norm.fit(train['SalePrice'])
print('n mu = {:.2f} and sigma = {:.2f}n'.format(mu, sigma))
plt.legend(['Normal dist. ($mu=$ {:.2f} and $sigma=$ {:.2f} )'.format(mu, sigma)],
            loc='best')
plt.ylabel('Frequency')
plt.title('SalePrice distribution')

fig =plt.figure()
res = stats.probplot(train['SalePrice'], plot=plt)
plt.show()


三、偏態(tài)數(shù)據(jù)處理

如果檢測(cè)到數(shù)據(jù)是呈偏態(tài)分布,我們需要將其其變換為正態(tài)分布,常用的幾種變換方式為:

1、對(duì)數(shù)變換:即將原始數(shù)據(jù)X的對(duì)數(shù)值作為新的分布數(shù)據(jù),適用于相乘關(guān)系的數(shù)據(jù)、高度偏態(tài)的數(shù)據(jù)

2、平方根變換:即即將原始數(shù)據(jù)X的平方根作為新的分布數(shù)據(jù)。適用于泊松分布(方差與均數(shù)近似相等)的數(shù)據(jù)、輕度偏態(tài)的數(shù)據(jù)

3、倒數(shù)變換1/x:即將原始數(shù)據(jù)X的倒數(shù)作為新的分析數(shù)據(jù)。適用于兩端波動(dòng)較大的數(shù)據(jù)

4、反正弦變換:即將原始數(shù)據(jù)X的平方根反正弦值做為新的分析數(shù)據(jù)。適用于百分比的數(shù)據(jù)、中度偏態(tài)的數(shù)據(jù)


#用對(duì)數(shù)化解決偏態(tài) log(1+x)
train['SalePrice'] = np.log1p(train['SalePrice'])
sns.distplot(train['SalePrice'],fit=norm)
(mu, sigma) = norm.fit(train['SalePrice'])
print( 'n mu = {:.2f} and sigma = {:.2f}n'.format(mu, sigma))

#Now plot the distribution
plt.legend(['Normal dist. ($mu=$ {:.2f} and $sigma=$ {:.2f} )'.format(mu, sigma)],
            loc='best')
plt.ylabel('Frequency')
plt.title('SalePrice distribution')

#Get also the QQ-plot
fig = plt.figure()
res = stats.probplot(train['SalePrice'], plot=plt)
plt.show()


相關(guān)性分析是一項(xiàng)重要的數(shù)據(jù)分析工具,可以幫助我們理解變量之間的關(guān)系并做出相應(yīng)的推斷。通過(guò)散點(diǎn)圖相關(guān)系數(shù)回歸分析等方法,我們可以定量地衡量變量之間的相關(guān)程度,并將其應(yīng)用于各個(gè)領(lǐng)域的研究與實(shí)踐中。深入理解相關(guān)性分析的原理和應(yīng)用,對(duì)于數(shù)據(jù)科學(xué)家和決策者來(lái)說(shuō)都是至關(guān)重要的技能。


想深入學(xué)習(xí)統(tǒng)計(jì)學(xué)知識(shí),為數(shù)據(jù)分析筑牢根基?那快來(lái)看看統(tǒng)計(jì)學(xué)極簡(jiǎn)入門課程!

學(xué)習(xí)入口:https://edu.cda.cn/goods/show/3386?targetId=5647&preview=0

課程由專業(yè)數(shù)據(jù)分析師打造,完全免費(fèi),60 天有效期且隨到隨學(xué)。它用獨(dú)特思路講重點(diǎn),從數(shù)據(jù)種類到統(tǒng)計(jì)學(xué)體系,內(nèi)容通俗易懂。學(xué)完它,能讓你輕松入門統(tǒng)計(jì)學(xué),還能提升數(shù)據(jù)分析能力。趕緊點(diǎn)擊鏈接開(kāi)啟學(xué)習(xí),讓自己在數(shù)據(jù)領(lǐng)域更上一層樓!

數(shù)據(jù)分析咨詢請(qǐng)掃描二維碼

若不方便掃碼,搜微信號(hào):CDAshujufenxi

數(shù)據(jù)分析師資訊
更多

OK
客服在線
立即咨詢
客服在線
立即咨詢
') } function initGt() { var handler = function (captchaObj) { captchaObj.appendTo('#captcha'); captchaObj.onReady(function () { $("#wait").hide(); }).onSuccess(function(){ $('.getcheckcode').removeClass('dis'); $('.getcheckcode').trigger('click'); }); window.captchaObj = captchaObj; }; $('#captcha').show(); $.ajax({ url: "/login/gtstart?t=" + (new Date()).getTime(), // 加隨機(jī)數(shù)防止緩存 type: "get", dataType: "json", success: function (data) { $('#text').hide(); $('#wait').show(); // 調(diào)用 initGeetest 進(jìn)行初始化 // 參數(shù)1:配置參數(shù) // 參數(shù)2:回調(diào),回調(diào)的第一個(gè)參數(shù)驗(yàn)證碼對(duì)象,之后可以使用它調(diào)用相應(yīng)的接口 initGeetest({ // 以下 4 個(gè)配置參數(shù)為必須,不能缺少 gt: data.gt, challenge: data.challenge, offline: !data.success, // 表示用戶后臺(tái)檢測(cè)極驗(yàn)服務(wù)器是否宕機(jī) new_captcha: data.new_captcha, // 用于宕機(jī)時(shí)表示是新驗(yàn)證碼的宕機(jī) product: "float", // 產(chǎn)品形式,包括:float,popup width: "280px", https: true // 更多配置參數(shù)說(shuō)明請(qǐng)參見(jiàn):http://docs.geetest.com/install/client/web-front/ }, handler); } }); } function codeCutdown() { if(_wait == 0){ //倒計(jì)時(shí)完成 $(".getcheckcode").removeClass('dis').html("重新獲取"); }else{ $(".getcheckcode").addClass('dis').html("重新獲取("+_wait+"s)"); _wait--; setTimeout(function () { codeCutdown(); },1000); } } function inputValidate(ele,telInput) { var oInput = ele; var inputVal = oInput.val(); var oType = ele.attr('data-type'); var oEtag = $('#etag').val(); var oErr = oInput.closest('.form_box').next('.err_txt'); var empTxt = '請(qǐng)輸入'+oInput.attr('placeholder')+'!'; var errTxt = '請(qǐng)輸入正確的'+oInput.attr('placeholder')+'!'; var pattern; if(inputVal==""){ if(!telInput){ errFun(oErr,empTxt); } return false; }else { switch (oType){ case 'login_mobile': pattern = /^1[3456789]\d{9}$/; if(inputVal.length==11) { $.ajax({ url: '/login/checkmobile', type: "post", dataType: "json", data: { mobile: inputVal, etag: oEtag, page_ur: window.location.href, page_referer: document.referrer }, success: function (data) { } }); } break; case 'login_yzm': pattern = /^\d{6}$/; break; } if(oType=='login_mobile'){ } if(!!validateFun(pattern,inputVal)){ errFun(oErr,'') if(telInput){ $('.getcheckcode').removeClass('dis'); } }else { if(!telInput) { errFun(oErr, errTxt); }else { $('.getcheckcode').addClass('dis'); } return false; } } return true; } function errFun(obj,msg) { obj.html(msg); if(msg==''){ $('.login_submit').removeClass('dis'); }else { $('.login_submit').addClass('dis'); } } function validateFun(pat,val) { return pat.test(val); }