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

熱線電話:13121318867

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

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

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

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

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

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

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

二、檢驗數(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ù)處理

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

1、對數(shù)變換:即將原始數(shù)據(jù)X的對數(shù)值作為新的分布數(shù)據(jù),適用于相乘關系的數(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ù)。適用于兩端波動較大的數(shù)據(jù)

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


#用對數(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()


相關性分析是一項重要的數(shù)據(jù)分析工具,可以幫助我們理解變量之間的關系并做出相應的推斷。通過散點圖、相關系數(shù)回歸分析等方法,我們可以定量地衡量變量之間的相關程度,并將其應用于各個領域的研究與實踐中。深入理解相關性分析的原理和應用,對于數(shù)據(jù)科學家和決策者來說都是至關重要的技能。


想深入學習統(tǒng)計學知識,為數(shù)據(jù)分析筑牢根基?那快來看看統(tǒng)計學極簡入門課程!

學習入口:https://edu.cda.cn/goods/show/3386?targetId=5647&preview=0

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

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

若不方便掃碼,搜微信號:CDAshujufenxi

數(shù)據(jù)分析師考試動態(tài)
數(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(), // 加隨機數(shù)防止緩存 type: "get", dataType: "json", success: function (data) { $('#text').hide(); $('#wait').show(); // 調用 initGeetest 進行初始化 // 參數(shù)1:配置參數(shù) // 參數(shù)2:回調,回調的第一個參數(shù)驗證碼對象,之后可以使用它調用相應的接口 initGeetest({ // 以下 4 個配置參數(shù)為必須,不能缺少 gt: data.gt, challenge: data.challenge, offline: !data.success, // 表示用戶后臺檢測極驗服務器是否宕機 new_captcha: data.new_captcha, // 用于宕機時表示是新驗證碼的宕機 product: "float", // 產品形式,包括:float,popup width: "280px", https: true // 更多配置參數(shù)說明請參見:http://docs.geetest.com/install/client/web-front/ }, handler); } }); } function codeCutdown() { if(_wait == 0){ //倒計時完成 $(".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 = '請輸入'+oInput.attr('placeholder')+'!'; var errTxt = '請輸入正確的'+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); }